Only add StepResult for Tasks, not the Job itself (#2620)

This commit is contained in:
Cameron Booth
2023-06-30 04:17:46 -07:00
committed by GitHub
parent 4ffd081aea
commit d4bbbb8419
2 changed files with 24 additions and 21 deletions

View File

@@ -477,28 +477,32 @@ namespace GitHub.Runner.Worker
PublishStepTelemetry();
var stepResult = new StepResult
if (_record.RecordType == "Task")
{
ExternalID = _record.Id,
Conclusion = _record.Result ?? TaskResult.Succeeded,
Status = _record.State,
Number = _record.Order,
Name = _record.Name,
StartedAt = _record.StartTime,
CompletedAt = _record.FinishTime,
Annotations = new List<Annotation>()
};
_record.Issues?.ForEach(issue =>
{
var annotation = issue.ToAnnotation();
if (annotation != null)
var stepResult = new StepResult
{
stepResult.Annotations.Add(annotation.Value);
}
});
ExternalID = _record.Id,
Conclusion = _record.Result ?? TaskResult.Succeeded,
Status = _record.State,
Number = _record.Order,
Name = _record.Name,
StartedAt = _record.StartTime,
CompletedAt = _record.FinishTime,
Annotations = new List<Annotation>()
};
_record.Issues?.ForEach(issue =>
{
var annotation = issue.ToAnnotation();
if (annotation != null)
{
stepResult.Annotations.Add(annotation.Value);
}
});
Global.StepsResult.Add(stepResult);
}
Global.StepsResult.Add(stepResult);
if (Root != this)
{

View File

@@ -821,8 +821,7 @@ namespace GitHub.Runner.Common.Tests.Worker
ec.Complete();
// Assert.
Assert.Equal(1, ec.Global.StepsResult.Count);
Assert.Equal(TaskResult.Succeeded, ec.Global.StepsResult.Single().Conclusion);
Assert.Equal(0, ec.Global.StepsResult.Count);
}
}