Only execute post for actions that have one

This commit is contained in:
Ferenc Hammerl
2021-11-12 13:31:37 +01:00
parent 85e1927754
commit 9675941fdb

View File

@@ -269,16 +269,19 @@ namespace GitHub.Runner.Worker
} }
else if (depth > 0) else if (depth > 0)
{ {
// if we're in a composite action and haven't loaded the local action yet var definition = LoadAction(executionContext, action);
// we assume it has a post step if (definition.Data.Execution.HasPost) {
if (!_cachedEmbeddedPostSteps.ContainsKey(parentStepId)) // if we're in a composite action and haven't loaded the local action yet
{ // we assume it has a post step
// If we haven't done so already, add the parent to the post steps if (!_cachedEmbeddedPostSteps.ContainsKey(parentStepId))
_cachedEmbeddedPostSteps[parentStepId] = new Stack<Pipelines.ActionStep>(); {
// If we haven't done so already, add the parent to the post steps
_cachedEmbeddedPostSteps[parentStepId] = new Stack<Pipelines.ActionStep>();
}
// Clone action so we can modify the condition without affecting the original
var clonedAction = action.Clone() as Pipelines.ActionStep;
_cachedEmbeddedPostSteps[parentStepId].Push(clonedAction);
} }
// Clone action so we can modify the condition without affecting the original
var clonedAction = action.Clone() as Pipelines.ActionStep;
_cachedEmbeddedPostSteps[parentStepId].Push(clonedAction);
} }
} }
} }