Composite Code Cleanup (#1232)

* composite polish

* Cleanup Condition Handling

* Refactor ConditionTraceWriter

* pr feedback

* cleanup
This commit is contained in:
Thomas Boop
2021-08-02 14:57:25 -04:00
committed by GitHub
parent 92ec3d0f29
commit 85ce33b1d3
5 changed files with 184 additions and 52 deletions

View File

@@ -247,7 +247,10 @@ namespace GitHub.Runner.Worker
{
_cachedEmbeddedPreSteps[parentStepId] = new List<Pipelines.ActionStep>();
}
_cachedEmbeddedPreSteps[parentStepId].Add(action);
// Clone action so we can modify the condition without affecting the original
var clonedAction = action.Clone() as Pipelines.ActionStep;
clonedAction.Condition = definition.Data.Execution.InitCondition;
_cachedEmbeddedPreSteps[parentStepId].Add(clonedAction);
}
}
@@ -258,7 +261,10 @@ namespace GitHub.Runner.Worker
// If we haven't done so already, add the parent to the post steps
_cachedEmbeddedPostSteps[parentStepId] = new Stack<Pipelines.ActionStep>();
}
_cachedEmbeddedPostSteps[parentStepId].Push(action);
// Clone action so we can modify the condition without affecting the original
var clonedAction = action.Clone() as Pipelines.ActionStep;
clonedAction.Condition = definition.Data.Execution.CleanupCondition;
_cachedEmbeddedPostSteps[parentStepId].Push(clonedAction);
}
}
}