Only execute post for actions that have one (#1481)

* Only execute post for actions that have one

* Revert haspost check

* Remove launch commit

* Remove comment

* Restore whitespace

* Restore wspace
This commit is contained in:
Ferenc Hammerl
2021-11-18 17:56:13 +01:00
committed by GitHub
parent dcc5d34ad1
commit 4dc8a09db3

View File

@@ -278,7 +278,7 @@ namespace GitHub.Runner.Worker
} }
// Clone action so we can modify the condition without affecting the original // Clone action so we can modify the condition without affecting the original
var clonedAction = action.Clone() as Pipelines.ActionStep; var clonedAction = action.Clone() as Pipelines.ActionStep;
_cachedEmbeddedPostSteps[parentStepId].Push(clonedAction); _cachedEmbeddedPostSteps[parentStepId].Push(clonedAction);
} }
} }
} }
@@ -443,7 +443,7 @@ namespace GitHub.Runner.Worker
{ {
for (var i = 0; i < compositeAction.Steps.Count; i++) for (var i = 0; i < compositeAction.Steps.Count; i++)
{ {
// Store Id's for later load actions // Load stored Ids for later load actions
compositeAction.Steps[i].Id = _cachedEmbeddedStepIds[action.Id][i]; compositeAction.Steps[i].Id = _cachedEmbeddedStepIds[action.Id][i];
if (string.IsNullOrEmpty(executionContext.Global.Variables.Get("DistributedTask.EnableCompositeActions")) && compositeAction.Steps[i].Reference.Type != Pipelines.ActionSourceType.Script) if (string.IsNullOrEmpty(executionContext.Global.Variables.Get("DistributedTask.EnableCompositeActions")) && compositeAction.Steps[i].Reference.Type != Pipelines.ActionSourceType.Script)
{ {
@@ -451,6 +451,16 @@ namespace GitHub.Runner.Worker
} }
} }
} }
else
{
_cachedEmbeddedStepIds[action.Id] = new List<Guid>();
foreach (var compositeStep in compositeAction.Steps)
{
var guid = Guid.NewGuid();
compositeStep.Id = guid;
_cachedEmbeddedStepIds[action.Id].Add(guid);
}
}
} }
else else
{ {