From 9675941fdb52c0023cf108b39e921e0a82031e89 Mon Sep 17 00:00:00 2001 From: Ferenc Hammerl Date: Fri, 12 Nov 2021 13:31:37 +0100 Subject: [PATCH] Only execute post for actions that have one --- src/Runner.Worker/ActionManager.cs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) 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); } } }