Support pre/post/container/composite actions within composite actions (#1222)

Support Composite Actions with uses: steps
This commit is contained in:
Thomas Boop
2021-07-28 15:35:21 -04:00
committed by GitHub
parent 5281434f3f
commit 4e95d0d6ad
11 changed files with 255 additions and 62 deletions

View File

@@ -295,8 +295,21 @@ namespace GitHub.Runner.Worker
{
throw new Exception("Required field 'name' is missing in ##[save-state] command.");
}
context.IntraActionState[stateName] = command.Data;
// Embedded steps (composite) keep track of the state at the root level
if (context.IsEmbedded)
{
var id = context.EmbeddedId;
if (!context.Root.EmbeddedIntraActionState.ContainsKey(id))
{
context.Root.EmbeddedIntraActionState[id] = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
}
context.Root.EmbeddedIntraActionState[id][stateName] = command.Data;
}
// Otherwise modify the ExecutionContext
else
{
context.IntraActionState[stateName] = command.Data;
}
context.Debug($"Save intra-action state {stateName} = {command.Data}");
}