mirror of
https://github.com/actions/runner.git
synced 2025-12-10 12:36:23 +00:00
Compare commits
6 Commits
v2.295.0
...
robherley/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e552c0cced | ||
|
|
e112193313 | ||
|
|
386fa86f91 | ||
|
|
412dc5c836 | ||
|
|
0361ffcbf9 | ||
|
|
25f6cb1d78 |
@@ -9,6 +9,7 @@ namespace GitHub.Runner.Common
|
|||||||
Externals,
|
Externals,
|
||||||
Root,
|
Root,
|
||||||
Actions,
|
Actions,
|
||||||
|
StepSummary,
|
||||||
Temp,
|
Temp,
|
||||||
Tools,
|
Tools,
|
||||||
Update,
|
Update,
|
||||||
@@ -196,6 +197,7 @@ namespace GitHub.Runner.Common
|
|||||||
public static readonly string DiagDirectory = "_diag";
|
public static readonly string DiagDirectory = "_diag";
|
||||||
public static readonly string ExternalsDirectory = "externals";
|
public static readonly string ExternalsDirectory = "externals";
|
||||||
public static readonly string RunnerDiagnosticLogPrefix = "Runner_";
|
public static readonly string RunnerDiagnosticLogPrefix = "Runner_";
|
||||||
|
public static readonly string StepSummaryDirectory = "_step_summary";
|
||||||
public static readonly string TempDirectory = "_temp";
|
public static readonly string TempDirectory = "_temp";
|
||||||
public static readonly string ToolDirectory = "_tool";
|
public static readonly string ToolDirectory = "_tool";
|
||||||
public static readonly string UpdateDirectory = "_update";
|
public static readonly string UpdateDirectory = "_update";
|
||||||
|
|||||||
@@ -243,6 +243,12 @@ namespace GitHub.Runner.Common
|
|||||||
path = new DirectoryInfo(GetDirectory(WellKnownDirectory.Bin)).Parent.FullName;
|
path = new DirectoryInfo(GetDirectory(WellKnownDirectory.Bin)).Parent.FullName;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WellKnownDirectory.StepSummary:
|
||||||
|
path = Path.Combine(
|
||||||
|
GetDirectory(WellKnownDirectory.Temp),
|
||||||
|
Constants.Path.StepSummaryDirectory);
|
||||||
|
break;
|
||||||
|
|
||||||
case WellKnownDirectory.Temp:
|
case WellKnownDirectory.Temp:
|
||||||
path = Path.Combine(
|
path = Path.Combine(
|
||||||
GetDirectory(WellKnownDirectory.Work),
|
GetDirectory(WellKnownDirectory.Work),
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -103,6 +104,10 @@ namespace GitHub.Runner.Worker
|
|||||||
// Set GITHUB_ACTION
|
// Set GITHUB_ACTION
|
||||||
step.ExecutionContext.SetGitHubContext("action", actionStep.Action.Name);
|
step.ExecutionContext.SetGitHubContext("action", actionStep.Action.Name);
|
||||||
|
|
||||||
|
var stepSummaryFilePath = CreateStepSummaryFile(step);
|
||||||
|
step.ExecutionContext.SetGitHubContext("step_summary", stepSummaryFilePath);
|
||||||
|
envContext["GITHUB_STEP_SUMMARY"] = new StringContextData(stepSummaryFilePath);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Evaluate and merge step env
|
// Evaluate and merge step env
|
||||||
@@ -352,7 +357,52 @@ namespace GitHub.Runner.Worker
|
|||||||
{
|
{
|
||||||
var executionContext = step.ExecutionContext;
|
var executionContext = step.ExecutionContext;
|
||||||
|
|
||||||
|
CreateSummaryAttachment(step);
|
||||||
|
|
||||||
executionContext.Complete(result, resultCode: resultCode);
|
executionContext.Complete(result, resultCode: resultCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string CreateStepSummaryFile(IStep step)
|
||||||
|
{
|
||||||
|
var stepSummaryDirectory = HostContext.GetDirectory(WellKnownDirectory.StepSummary);
|
||||||
|
if (!Directory.Exists(stepSummaryDirectory))
|
||||||
|
{
|
||||||
|
Trace.Info($"Creating step summary directory: {stepSummaryDirectory}");
|
||||||
|
Directory.CreateDirectory(stepSummaryDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
|
var stepID = step.ExecutionContext.Id;
|
||||||
|
var stepSummaryFilePath = Path.Combine(stepSummaryDirectory, $"{stepID}.md");
|
||||||
|
|
||||||
|
Trace.Info($"Creating step summary file: {stepSummaryFilePath}");
|
||||||
|
File.Create(stepSummaryFilePath).Close();
|
||||||
|
return stepSummaryFilePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CreateSummaryAttachment(IStep step) {
|
||||||
|
var executionContext = step.ExecutionContext;
|
||||||
|
var parentContext = executionContext.Root;
|
||||||
|
var stepSummaryFilePath = executionContext.GetGitHubContext("step_summary");
|
||||||
|
var stepID = executionContext.Id;
|
||||||
|
|
||||||
|
Trace.Info($"Reading step summary data from {stepSummaryFilePath}");
|
||||||
|
|
||||||
|
var summaryExists = File.Exists(stepSummaryFilePath);
|
||||||
|
if (summaryExists)
|
||||||
|
{
|
||||||
|
Trace.Info($"File exists: {stepSummaryFilePath}");
|
||||||
|
|
||||||
|
var summaryFileIsEmpty = new FileInfo(stepSummaryFilePath).Length == 0;
|
||||||
|
if (summaryFileIsEmpty)
|
||||||
|
{
|
||||||
|
Trace.Info($"Summary file ({summaryFileIsEmpty}) is empty, skipping attachment upload");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Trace.Info($"Queueing file ({stepSummaryFilePath}) for attachment upload ({stepID})");
|
||||||
|
parentContext.QueueAttachFile(ChecksAttachmentType.StepSummary, stepID.ToString(), stepSummaryFilePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -102,4 +102,10 @@ namespace GitHub.DistributedTask.WebApi
|
|||||||
public static readonly String FileAttachment = "DistributedTask.Core.FileAttachment";
|
public static readonly String FileAttachment = "DistributedTask.Core.FileAttachment";
|
||||||
public static readonly String DiagnosticLog = "DistributedTask.Core.DiagnosticLog";
|
public static readonly String DiagnosticLog = "DistributedTask.Core.DiagnosticLog";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[GenerateAllConstants]
|
||||||
|
public class ChecksAttachmentType
|
||||||
|
{
|
||||||
|
public static readonly String StepSummary = "Checks.Step.Summary";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
2.286.0
|
2.286.2
|
||||||
|
|||||||
Reference in New Issue
Block a user