diff --git a/src/Runner.Worker/ActionManager.cs b/src/Runner.Worker/ActionManager.cs index d228233bd..47a645d5d 100644 --- a/src/Runner.Worker/ActionManager.cs +++ b/src/Runner.Worker/ActionManager.cs @@ -269,16 +269,19 @@ namespace GitHub.Runner.Worker } else if (depth > 0) { - // if we're in a composite action and haven't loaded the local action yet - // we assume it has a post step - if (!_cachedEmbeddedPostSteps.ContainsKey(parentStepId)) - { - // If we haven't done so already, add the parent to the post steps - _cachedEmbeddedPostSteps[parentStepId] = new Stack(); + var definition = LoadAction(executionContext, action); + if (definition.Data.Execution.HasPost) { + // if we're in a composite action and haven't loaded the local action yet + // we assume it has a post step + if (!_cachedEmbeddedPostSteps.ContainsKey(parentStepId)) + { + // If we haven't done so already, add the parent to the post steps + _cachedEmbeddedPostSteps[parentStepId] = new Stack(); + } + // 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); } } }