This commit is contained in:
Chris Sidi
2020-05-19 21:09:38 -04:00
parent b45c1b9440
commit 904eb7df8a
3 changed files with 20 additions and 8 deletions

View File

@@ -254,13 +254,20 @@ namespace GitHub.Runner.Worker
public void RegisterPostJobStep(IStep step) public void RegisterPostJobStep(IStep step)
{ {
if (step is IActionRunner actionRunner && !Root.StepsWithPostRegistered.Add(actionRunner.Action.Id)) var actionRunner = step as IActionRunner;
if (actionRunner != null && !Root.StepsWithPostRegistered.Add(actionRunner.Action.Id))
{ {
Trace.Info($"'post' of '{actionRunner.DisplayName}' already push to post step stack."); Trace.Info($"'post' of '{actionRunner.DisplayName}' already push to post step stack.");
return; return;
} }
step.ExecutionContext = Root.CreatePostChild(step.DisplayName, IntraActionState); string refName = null;
if (actionRunner != null)
{
refName = actionRunner.Action.Reference.ToString();
}
step.ExecutionContext = Root.CreatePostChild(step.DisplayName, refName, IntraActionState);
Root.PostJobSteps.Push(step); Root.PostJobSteps.Push(step);
} }
@@ -861,7 +868,7 @@ namespace GitHub.Runner.Worker
} }
} }
private IExecutionContext CreatePostChild(string displayName, Dictionary<string, string> intraActionState) private IExecutionContext CreatePostChild(string displayName, string refName, Dictionary<string, string> intraActionState)
{ {
if (!_expandedForPostJob) if (!_expandedForPostJob)
{ {
@@ -871,7 +878,7 @@ namespace GitHub.Runner.Worker
} }
var newGuid = Guid.NewGuid(); var newGuid = Guid.NewGuid();
return CreateChild(newGuid, displayName, newGuid.ToString("N"), null, null, intraActionState, _childTimelineRecordOrder - Root.PostJobSteps.Count); return CreateChild(newGuid, displayName, refName ?? newGuid.ToString("N"), null, null, intraActionState, _childTimelineRecordOrder - Root.PostJobSteps.Count);
} }
} }

View File

@@ -271,7 +271,7 @@ namespace GitHub.Runner.Worker
{ {
ArgUtil.NotNull(actionStep, step.DisplayName); ArgUtil.NotNull(actionStep, step.DisplayName);
Guid stepId = Guid.NewGuid(); Guid stepId = Guid.NewGuid();
actionStep.ExecutionContext = jobContext.CreateChild(stepId, actionStep.DisplayName, stepId.ToString("N"), null, null, intraActionStates[actionStep.Action.Id]); actionStep.ExecutionContext = jobContext.CreateChild(stepId, actionStep.DisplayName, actionStep.Action.Reference.ToString(), null, null, intraActionStates[actionStep.Action.Id]);
} }
} }
@@ -282,7 +282,7 @@ namespace GitHub.Runner.Worker
{ {
ArgUtil.NotNull(actionStep, step.DisplayName); ArgUtil.NotNull(actionStep, step.DisplayName);
intraActionStates.TryGetValue(actionStep.Action.Id, out var intraActionState); intraActionStates.TryGetValue(actionStep.Action.Id, out var intraActionState);
actionStep.ExecutionContext = jobContext.CreateChild(actionStep.Action.Id, actionStep.DisplayName, actionStep.Action.Name, actionStep.Action.ScopeName, actionStep.Action.ContextName, intraActionState); actionStep.ExecutionContext = jobContext.CreateChild(actionStep.Action.Id, actionStep.DisplayName, actionStep.Action.Reference.ToString(), actionStep.Action.ScopeName, actionStep.Action.ContextName, intraActionState);
} }
} }

View File

@@ -128,6 +128,11 @@ namespace GitHub.DistributedTask.Pipelines
{ {
return new RepositoryPathReference(this); return new RepositoryPathReference(this);
} }
public override string ToString()
{
return $"ActionRef,RepositoryPath: {Name}@{Ref}";
}
} }
[EditorBrowsable(EditorBrowsableState.Never)] [EditorBrowsable(EditorBrowsableState.Never)]