How do you set the working directory for a specific 'run:' step to a subdirectory?
Select an answer to reveal the explanation.
Short Explanation and Infographic
The 'working-directory:' key at step level sets where the shell starts — cleaner than cd-ing every time.
Full explanation below image
Full Explanation
The 'working-directory:' key can be set at the step level (applies to one step), job level as part of 'defaults.run.working-directory:' (applies to all run steps in the job), or at the workflow level in 'defaults.run.working-directory:' (applies to all run steps in all jobs). The step-level value takes precedence over job/workflow defaults. Using 'cd' in the run script works but doesn't persist to the next step. 'directory:' is not a valid key. Modifying GITHUB_WORKSPACE is not the correct approach — it's an environment variable pointing to the repo root.