mirror of
https://github.com/actions/runner.git
synced 2025-12-18 08:17:02 +00:00
Fix env format
This commit is contained in:
@@ -75,6 +75,8 @@ namespace GitHub.Runner.Worker
|
||||
}
|
||||
|
||||
var actionMapping = token.AssertMapping("action manifest root");
|
||||
var envComposite = default(MappingToken);
|
||||
|
||||
foreach (var actionPair in actionMapping)
|
||||
{
|
||||
var propertyName = actionPair.Key.AssertString($"action.yml property key");
|
||||
@@ -93,9 +95,14 @@ namespace GitHub.Runner.Worker
|
||||
ConvertInputs(context, actionPair.Value, actionDefinition);
|
||||
break;
|
||||
|
||||
case "runs":
|
||||
actionDefinition.Execution = ConvertRuns(executionContext, context, actionPair.Value);
|
||||
case "env":
|
||||
envComposite = actionPair.Value.AssertMapping("env");
|
||||
break;
|
||||
|
||||
case "runs":
|
||||
actionDefinition.Execution = ConvertRuns(executionContext, context, actionPair.Value, envComposite);
|
||||
break;
|
||||
|
||||
default:
|
||||
Trace.Info($"Ignore action property {propertyName}.");
|
||||
break;
|
||||
@@ -340,7 +347,8 @@ namespace GitHub.Runner.Worker
|
||||
private ActionExecutionData ConvertRuns(
|
||||
IExecutionContext executionContext,
|
||||
TemplateContext context,
|
||||
TemplateToken inputsToken)
|
||||
TemplateToken inputsToken,
|
||||
MappingToken envComposite)
|
||||
{
|
||||
var runsMapping = inputsToken.AssertMapping("runs");
|
||||
var usingToken = default(StringToken);
|
||||
@@ -469,10 +477,15 @@ namespace GitHub.Runner.Worker
|
||||
return new CompositeActionExecutionData()
|
||||
{
|
||||
Steps = stepsLoaded,
|
||||
Environment = envToken
|
||||
Environment = envComposite
|
||||
};
|
||||
}
|
||||
}
|
||||
// If there is an env set and it's not for composite action, yield an error
|
||||
if (envComposite != null && string.IsNullOrEmpty(Environment.GetEnvironmentVariable("TESTING_COMPOSITE_ACTIONS_ALPHA")))
|
||||
{
|
||||
throw new ArgumentException("You cannot use env unless you are using Composite Actions");
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentOutOfRangeException($"'using: {usingToken.Value}' is not supported, use 'docker' or 'node12' instead.");
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
"name": "string",
|
||||
"description": "string",
|
||||
"inputs": "inputs",
|
||||
"env": "runs-env",
|
||||
"runs": "runs"
|
||||
},
|
||||
"loose-key-type": "non-empty-string",
|
||||
@@ -88,7 +89,6 @@
|
||||
"mapping": {
|
||||
"properties": {
|
||||
"using": "non-empty-string",
|
||||
"env": "runs-env",
|
||||
"steps": "composite-steps"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user