First attempt at creating baseline code for composite actions

This commit is contained in:
Ethan Chiu
2020-06-10 17:50:14 -04:00
parent 5815819f24
commit e2bb8d9e24
7 changed files with 109 additions and 1 deletions

View File

@@ -311,6 +311,13 @@ namespace GitHub.Runner.Worker
var postToken = default(StringToken);
var postEntrypointToken = default(StringToken);
var postIfToken = default(StringToken);
// TODO: How do I represent stepsToken as a list of steps?
// Well for default value, we can set it to this?
// var stepsToken = runsMapping.AssertMapping("steps");
// Actually, not sure, let's just set it to MappingToken since AssertMapping("steps")
// returns a MappingToken
var stepsToken = default(MappingToken);
foreach (var run in runsMapping)
{
var runsKey = run.Key.AssertString("runs key").Value;
@@ -355,6 +362,9 @@ namespace GitHub.Runner.Worker
case "pre-if":
preIfToken = run.Value.AssertString("pre-if");
break;
case "steps":
stepsToken = run.Value.AssertMapping("steps");
break;
default:
Trace.Info($"Ignore run property {runsKey}.");
break;
@@ -402,6 +412,21 @@ namespace GitHub.Runner.Worker
};
}
}
// TODO: add composite stuff here
else if (string.Equals(usingToken.Value, "composite", StringComparison.OrdinalIgnoreCase))
{
if (stepsToken.Count <= 0)
{
throw new ArgumentNullException($"No steps provided.");
}
else
{
return new CompositeActionExecutionData()
{
Steps = stepsToken
};
}
}
else
{
throw new ArgumentOutOfRangeException($"'using: {usingToken.Value}' is not supported, use 'docker' or 'node12' instead.");