mirror of
https://github.com/actions/runner.git
synced 2025-12-13 19:03:44 +00:00
Add comments + fix action_yaml schema
This commit is contained in:
@@ -449,15 +449,6 @@ namespace GitHub.Runner.Worker
|
|||||||
definition.Data.Name = "Run";
|
definition.Data.Name = "Run";
|
||||||
definition.Data.Description = "Execute a script";
|
definition.Data.Description = "Execute a script";
|
||||||
}
|
}
|
||||||
// else if (definition.Data.Execution.ExecutionType == ActionExecutionType.Composite) {
|
|
||||||
// // var compositeAction = definition.Data.Execution as CompositeActionExecutionData;
|
|
||||||
// // // add Trace Info here later => maybe we don't need this?
|
|
||||||
// // Trace.Info($"Action pre composite file: {compositeAction.Pre ?? "N/A"}.");
|
|
||||||
// // // Trace.Info($"Action composite file: {compositeAction.Script}.");
|
|
||||||
// // Trace.Info($"Action post composite file: {compositeAction.Post ?? "N/A"}.");
|
|
||||||
|
|
||||||
// // We don't have to do anything since definition.Data contains everything we need.
|
|
||||||
// }
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new NotSupportedException(action.Reference.Type.ToString());
|
throw new NotSupportedException(action.Reference.Type.ToString());
|
||||||
|
|||||||
@@ -364,6 +364,7 @@ namespace GitHub.Runner.Worker
|
|||||||
break;
|
break;
|
||||||
case "steps":
|
case "steps":
|
||||||
stepsToken = run.Value.AssertMapping("steps");
|
stepsToken = run.Value.AssertMapping("steps");
|
||||||
|
// Maybe insert a for loop here instead since MappingToken is not supposed to be used in HandlerFactory.cs
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Trace.Info($"Ignore run property {runsKey}.");
|
Trace.Info($"Ignore run property {runsKey}.");
|
||||||
|
|||||||
@@ -17,5 +17,58 @@ namespace GitHub.Runner.Worker.Handlers
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: IMPLEMENT LOGIC FOR HANDLER CODE
|
// TODO: IMPLEMENT LOGIC FOR HANDLER CODE
|
||||||
|
public sealed class CompositeActionHandler : Handler, ICompositeActionHandler
|
||||||
|
{
|
||||||
|
public CompositeActionExecutionData Data { get; set; }
|
||||||
|
|
||||||
|
public async Task RunAsync(ActionRunStage stage)
|
||||||
|
{
|
||||||
|
// Copied from NodEscriptActionHandler.cs
|
||||||
|
// Validate args.
|
||||||
|
Trace.Entering();
|
||||||
|
ArgUtil.NotNull(Data, nameof(Data));
|
||||||
|
ArgUtil.NotNull(ExecutionContext, nameof(ExecutionContext));
|
||||||
|
ArgUtil.NotNull(Inputs, nameof(Inputs));
|
||||||
|
ArgUtil.Directory(ActionDirectory, nameof(ActionDirectory));
|
||||||
|
|
||||||
|
// Update the env dictionary.
|
||||||
|
AddInputsToEnvironment();
|
||||||
|
AddPrependPathToEnvironment();
|
||||||
|
|
||||||
|
// expose context to environment
|
||||||
|
// for example, this is how we know what OS the runner is running on
|
||||||
|
foreach (var context in ExecutionContext.ExpressionValues)
|
||||||
|
{
|
||||||
|
if (context.Value is IEnvironmentContextData runtimeContext && runtimeContext != null)
|
||||||
|
{
|
||||||
|
foreach (var env in runtimeContext.GetRuntimeEnvironmentVariables())
|
||||||
|
{
|
||||||
|
Environment[env.Key] = env.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add Actions Runtime server info
|
||||||
|
var systemConnection = ExecutionContext.Endpoints.Single(x => string.Equals(x.Name, WellKnownServiceEndpointNames.SystemVssConnection, StringComparison.OrdinalIgnoreCase));
|
||||||
|
Environment["ACTIONS_RUNTIME_URL"] = systemConnection.Url.AbsoluteUri;
|
||||||
|
Environment["ACTIONS_RUNTIME_TOKEN"] = systemConnection.Authorization.Parameters[EndpointAuthorizationParameters.AccessToken];
|
||||||
|
if (systemConnection.Data.TryGetValue("CacheServerUrl", out var cacheUrl) && !string.IsNullOrEmpty(cacheUrl))
|
||||||
|
{
|
||||||
|
Environment["ACTIONS_CACHE_URL"] = cacheUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Resolve steps
|
||||||
|
// How do I handle the MappingToken?
|
||||||
|
MappingToken target = null;
|
||||||
|
if (stage == ActionRunStage.Main)
|
||||||
|
{
|
||||||
|
target = Data.Steps;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -93,12 +93,177 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"steps": {
|
"steps": {
|
||||||
|
"sequence": {
|
||||||
|
"item-type": "steps-item"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"steps-item": {
|
||||||
|
"one-of": [
|
||||||
|
"run-step",
|
||||||
|
"regular-step",
|
||||||
|
"steps-template-reference"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"run-step": {
|
||||||
"mapping": {
|
"mapping": {
|
||||||
"properties": {
|
"properties": {
|
||||||
"run": "non-empty-string"
|
"name": "string-steps-context",
|
||||||
|
"id": "non-empty-string",
|
||||||
|
"if": "step-if",
|
||||||
|
"timeout-minutes": "number-steps-context",
|
||||||
|
"run": {
|
||||||
|
"type": "string-steps-context",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"continue-on-error": "boolean-steps-context",
|
||||||
|
"env": "step-env",
|
||||||
|
"working-directory": "string-steps-context",
|
||||||
|
"shell": "non-empty-string"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"regular-step": {
|
||||||
|
"mapping": {
|
||||||
|
"properties": {
|
||||||
|
"name": "string-steps-context",
|
||||||
|
"id": "non-empty-string",
|
||||||
|
"if": "step-if",
|
||||||
|
"continue-on-error": "boolean-steps-context",
|
||||||
|
"timeout-minutes": "number-steps-context",
|
||||||
|
"uses": {
|
||||||
|
"type": "non-empty-string",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"with": "step-with",
|
||||||
|
"env": "step-env"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"steps-template-reference": {
|
||||||
|
"mapping": {
|
||||||
|
"properties": {
|
||||||
|
"template": "non-empty-string",
|
||||||
|
"id": "non-empty-string",
|
||||||
|
"inputs": "steps-template-reference-inputs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"string-steps-context": {
|
||||||
|
"context": [
|
||||||
|
"github",
|
||||||
|
"needs",
|
||||||
|
"strategy",
|
||||||
|
"matrix",
|
||||||
|
"secrets",
|
||||||
|
"steps",
|
||||||
|
"job",
|
||||||
|
"runner",
|
||||||
|
"env",
|
||||||
|
"hashFiles(1,255)"
|
||||||
|
],
|
||||||
|
"string": {}
|
||||||
|
},
|
||||||
|
"step-if": {
|
||||||
|
"context": [
|
||||||
|
"github",
|
||||||
|
"needs",
|
||||||
|
"strategy",
|
||||||
|
"matrix",
|
||||||
|
"steps",
|
||||||
|
"job",
|
||||||
|
"runner",
|
||||||
|
"env",
|
||||||
|
"always(0,0)",
|
||||||
|
"failure(0,0)",
|
||||||
|
"cancelled(0,0)",
|
||||||
|
"success(0,0)",
|
||||||
|
"hashFiles(1,255)"
|
||||||
|
],
|
||||||
|
"string": {}
|
||||||
|
},
|
||||||
|
"number-steps-context": {
|
||||||
|
"context": [
|
||||||
|
"github",
|
||||||
|
"needs",
|
||||||
|
"strategy",
|
||||||
|
"matrix",
|
||||||
|
"secrets",
|
||||||
|
"steps",
|
||||||
|
"job",
|
||||||
|
"runner",
|
||||||
|
"env",
|
||||||
|
"hashFiles(1,255)"
|
||||||
|
],
|
||||||
|
"number": {}
|
||||||
|
},
|
||||||
|
"boolean-steps-context": {
|
||||||
|
"context": [
|
||||||
|
"github",
|
||||||
|
"needs",
|
||||||
|
"strategy",
|
||||||
|
"matrix",
|
||||||
|
"secrets",
|
||||||
|
"steps",
|
||||||
|
"job",
|
||||||
|
"runner",
|
||||||
|
"env",
|
||||||
|
"hashFiles(1,255)"
|
||||||
|
],
|
||||||
|
"boolean": {}
|
||||||
|
},
|
||||||
|
"step-env": {
|
||||||
|
"context": [
|
||||||
|
"github",
|
||||||
|
"needs",
|
||||||
|
"strategy",
|
||||||
|
"matrix",
|
||||||
|
"secrets",
|
||||||
|
"steps",
|
||||||
|
"job",
|
||||||
|
"runner",
|
||||||
|
"env",
|
||||||
|
"hashFiles(1,255)"
|
||||||
|
],
|
||||||
|
"mapping": {
|
||||||
|
"loose-key-type": "non-empty-string",
|
||||||
|
"loose-value-type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"step-with": {
|
||||||
|
"context": [
|
||||||
|
"github",
|
||||||
|
"needs",
|
||||||
|
"strategy",
|
||||||
|
"matrix",
|
||||||
|
"secrets",
|
||||||
|
"steps",
|
||||||
|
"job",
|
||||||
|
"runner",
|
||||||
|
"env",
|
||||||
|
"hashFiles(1,255)"
|
||||||
|
],
|
||||||
|
"mapping": {
|
||||||
|
"loose-key-type": "non-empty-string",
|
||||||
|
"loose-value-type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"steps-template-reference-inputs": {
|
||||||
|
"context": [
|
||||||
|
"github",
|
||||||
|
"needs",
|
||||||
|
"strategy",
|
||||||
|
"matrix",
|
||||||
|
"secrets",
|
||||||
|
"steps",
|
||||||
|
"job",
|
||||||
|
"runner",
|
||||||
|
"env"
|
||||||
|
],
|
||||||
|
"mapping": {
|
||||||
|
"loose-key-type": "non-empty-string",
|
||||||
|
"loose-value-type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
"container-runs-context": {
|
"container-runs-context": {
|
||||||
"context": [
|
"context": [
|
||||||
"inputs"
|
"inputs"
|
||||||
|
|||||||
Reference in New Issue
Block a user