From dae2319f5b1b559e2e84908d6ab464fd33a8d600 Mon Sep 17 00:00:00 2001 From: Thomas Boop Date: Tue, 5 Apr 2022 21:59:06 -0400 Subject: [PATCH] fix an issue where container hooks used the job default working directory --- src/Runner.Worker/Handlers/ScriptHandler.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Runner.Worker/Handlers/ScriptHandler.cs b/src/Runner.Worker/Handlers/ScriptHandler.cs index 598a28a2f1a..9844f05259a 100644 --- a/src/Runner.Worker/Handlers/ScriptHandler.cs +++ b/src/Runner.Worker/Handlers/ScriptHandler.cs @@ -153,7 +153,8 @@ public async Task RunAsync(ActionRunStage stage) string workingDirectory = null; if (!Inputs.TryGetValue("workingDirectory", out workingDirectory)) { - if (string.IsNullOrEmpty(ExecutionContext.ScopeName) && ExecutionContext.Global.JobDefaults.TryGetValue("run", out var runDefaults)) + // Don't use job level working directories for hooks + if (IsActionStep && string.IsNullOrEmpty(ExecutionContext.ScopeName) && ExecutionContext.Global.JobDefaults.TryGetValue("run", out var runDefaults)) { if (runDefaults.TryGetValue("working-directory", out workingDirectory)) {