Add safety check to prevent from checking defaults in ScriptHandler for composite action

This commit is contained in:
Ethan Chiu
2020-07-21 14:33:58 -04:00
parent 6602117989
commit aeae15de7b
2 changed files with 12 additions and 5 deletions

View File

@@ -153,7 +153,7 @@ namespace GitHub.Runner.Worker.Handlers
{
// TODO: figure out how defaults interact with template later
// for now, we won't check job.defaults if we are inside a template.
if (string.IsNullOrEmpty(ExecutionContext.ScopeName) && ExecutionContext.Global.JobDefaults.TryGetValue("run", out var runDefaults))
if (!ExecutionContext.IsComposite && string.IsNullOrEmpty(ExecutionContext.ScopeName) && ExecutionContext.Global.JobDefaults.TryGetValue("run", out var runDefaults))
{
if (runDefaults.TryGetValue("working-directory", out workingDirectory))
{
@@ -169,7 +169,7 @@ namespace GitHub.Runner.Worker.Handlers
{
// TODO: figure out how defaults interact with template later
// for now, we won't check job.defaults if we are inside a template.
if (string.IsNullOrEmpty(ExecutionContext.ScopeName) && ExecutionContext.Global.JobDefaults.TryGetValue("run", out var runDefaults))
if (!ExecutionContext.IsComposite && string.IsNullOrEmpty(ExecutionContext.ScopeName) && ExecutionContext.Global.JobDefaults.TryGetValue("run", out var runDefaults))
{
if (runDefaults.TryGetValue("shell", out shell))
{