From 523f2afd55b894db050eaa64535916a5fe21eb86 Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Wed, 6 Mar 2024 08:34:17 -0500 Subject: [PATCH 1/9] Document `jobs..defaults.run.working-directory` * Documents `jobs..defaults.run.shell` * Refactors a number of elements into data.reusables * Adds warning that `working-directory` must exist --- .../workflow-syntax-for-github-actions.md | 35 ++++++++++++------- ...-values-for-jobs-defaults-job-run-shell.md | 10 ++++++ ...jobs-defaults-job-run-working-directory.md | 10 ++++++ ...efault-values-for-jobs-defaults-job-run.md | 4 ++- .../jobs/working-directory-must-exist.md | 6 ++++ data/reusables/actions/reusable-keyword.md | 2 ++ data/reusables/actions/supported-shells.md | 10 ++++++ 7 files changed, 63 insertions(+), 14 deletions(-) create mode 100644 data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-job-run-shell.md create mode 100644 data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-job-run-working-directory.md create mode 100644 data/reusables/actions/jobs/working-directory-must-exist.md create mode 100644 data/reusables/actions/reusable-keyword.md create mode 100644 data/reusables/actions/supported-shells.md diff --git a/content/actions/using-workflows/workflow-syntax-for-github-actions.md b/content/actions/using-workflows/workflow-syntax-for-github-actions.md index 566d231284d03..cbbb3e7faef97 100644 --- a/content/actions/using-workflows/workflow-syntax-for-github-actions.md +++ b/content/actions/using-workflows/workflow-syntax-for-github-actions.md @@ -264,6 +264,14 @@ env: {% data reusables.actions.jobs.setting-default-values-for-jobs-defaults-run %} +## `defaults.run.shell` + +{% data reusables.actions.jobs.setting-default-values-for-jobs-defaults-run-shell %} + +## `defaults.run.working-directory` + +{% data reusables.actions.jobs.setting-default-values-for-jobs-defaults-run-working-directory %} + ## `concurrency` {% data reusables.actions.jobs.section-using-concurrency %} @@ -345,6 +353,14 @@ jobs: {% data reusables.actions.jobs.setting-default-values-for-jobs-defaults-job-run %} +## `jobs..defaults.run.shell` + +{% data reusables.actions.jobs.setting-default-values-for-jobs-defaults-job-run-shell %} + +## `jobs..defaults.run.working-directory` + +{% data reusables.actions.jobs.setting-default-values-for-jobs-defaults-job-run-working-directory %} + ### Example: Setting default `run` step options for a job {% data reusables.actions.jobs.setting-default-run-value-for-job-example %} @@ -616,24 +632,17 @@ Using the `working-directory` keyword, you can specify the working directory of working-directory: ./temp ``` -Alternatively, you can specify a default working directory for all `run` steps in a job, or for all `run` steps in the entire workflow. For more information, see "[`defaults.run`](/actions/using-workflows/workflow-syntax-for-github-actions#defaultsrun)" and "[`jobs..defaults.run`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_iddefaultsrun)." +Alternatively, you can specify a default working directory for all `run` steps in a job, or for all `run` steps in the entire workflow. For more information, see "[`defaults.run.working-directory`](/actions/using-workflows/workflow-syntax-for-github-actions#defaultsrunworkingdirectory)" and "[`jobs..defaults.run.working-directory`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_iddefaultsrunworkingdirectory)." You can also use a `run` step to run a script. For more information, see "[AUTOTITLE](/actions/learn-github-actions/essential-features-of-github-actions#adding-scripts-to-your-workflow)." ## `jobs..steps[*].shell` -You can override the default shell settings in the runner's operating system using the `shell` keyword. You can use built-in `shell` keywords, or you can define a custom set of shell options. The shell command that is run internally executes a temporary file that contains the commands specified in the `run` keyword. - -| Supported platform | `shell` parameter | Description | Command run internally | -| ------------------ | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- | -| Linux / macOS | unspecified | The default shell on non-Windows platforms. Note that this runs a different command to when `bash` is specified explicitly. If `bash` is not found in the path, this is treated as `sh`. | `bash -e {0}` | -| All | `bash` | The default shell on non-Windows platforms with a fallback to `sh`. When specifying a bash shell on Windows, the bash shell included with Git for Windows is used. | `bash --noprofile --norc -eo pipefail {0}` | -| All | `pwsh` | The PowerShell Core. {% data variables.product.prodname_dotcom %} appends the extension `.ps1` to your script name. | `pwsh -command ". '{0}'"` | -| All | `python` | Executes the python command. | `python {0}` | -| Linux / macOS | `sh` | The fallback behavior for non-Windows platforms if no shell is provided and `bash` is not found in the path. | `sh -e {0}` | -| Windows | `cmd` | {% data variables.product.prodname_dotcom %} appends the extension `.cmd` to your script name and substitutes for `{0}`. | `%ComSpec% /D /E:ON /V:OFF /S /C "CALL "{0}""`. | -| Windows | `pwsh` | This is the default shell used on Windows. The PowerShell Core. {% data variables.product.prodname_dotcom %} appends the extension `.ps1` to your script name. If your self-hosted Windows runner does not have _PowerShell Core_ installed, then _PowerShell Desktop_ is used instead. | `pwsh -command ". '{0}'"`. | -| Windows | `powershell` | The PowerShell Desktop. {% data variables.product.prodname_dotcom %} appends the extension `.ps1` to your script name. | `powershell -command ". '{0}'"`. | +You can override the default shell settings in the runner's operating system and the job's default using the `shell` keyword. You can use built-in `shell` keywords, or you can define a custom set of shell options. The shell command that is run internally executes a temporary file that contains the commands specified in the `run` keyword. + +{% data reusables.actions.supported-shells %} + +Alternatively, you can specify a default shell for all `run` steps in a job, or for all `run` steps in the entire workflow. For more information, see "[`defaults.run.shell`](/actions/using-workflows/workflow-syntax-for-github-actions#defaultsrunshell)" and "[`jobs..defaults.run.shell`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_iddefaultsrunshell)." ### Example: Running a command using Bash diff --git a/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-job-run-shell.md b/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-job-run-shell.md new file mode 100644 index 0000000000000..06f2b0a6aebf4 --- /dev/null +++ b/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-job-run-shell.md @@ -0,0 +1,10 @@ +Use `shell` to define the `shell` for a step. {% data reusables.actions.reusable-keyword %} + +{% data reusables.actions.supported-shells %} + +The `shell` for a step is taken from the first defined in this list: +1. the step `jobs..steps[*].run.shell`. See [`jobs..steps[*].shell`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell). +1. the job `jobs..defaults.run.shell`. See [`jobs..defaults.run.shell`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_iddefaultsrunshell). +1. the workflow `defaults.run.shell`. See [`defaults.run.shell`](/actions/using-workflows/workflow-syntax-for-github-actions#defaultsrunshell). + +{% data reusables.actions.defaults-override %} diff --git a/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-job-run-working-directory.md b/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-job-run-working-directory.md new file mode 100644 index 0000000000000..598bc849ae192 --- /dev/null +++ b/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-job-run-working-directory.md @@ -0,0 +1,10 @@ +Use `working-directory` to define the working directory for the `shell` for a step. {% data reusables.actions.reusable-keyword %} + +{% data reusables.actions.working-directory-must-exist %} + +The `working-directory` for a step is taken from the first defined in this list: +1. the step `jobs..steps[*].run.working-directory`. See [`jobs..steps[*].working-directory`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsworking-directory). +1. the job `jobs..defaults.run.working-directory`. See [`jobs..defaults.run.working-directory`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_iddefaultsrunworkingdirectory). +1. the workflow `defaults.run.working-directory`. See [`defaults.run.working-directory`](/actions/using-workflows/workflow-syntax-for-github-actions#defaultsrunworkingdirectory). + +{% data reusables.actions.defaults-override %} diff --git a/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-job-run.md b/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-job-run.md index 6b3e12ded1680..8d9c030e98cc2 100644 --- a/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-job-run.md +++ b/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-job-run.md @@ -1,5 +1,7 @@ -Use `jobs..defaults.run` to provide default `shell` and `working-directory` to all `run` steps in the job. This keyword can reference several contexts. For more information, see "[Contexts](/actions/learn-github-actions/contexts#context-availability)." +Use `jobs..defaults.run` to provide default `shell` and `working-directory` to all `run` steps in the job. You can provide default `shell` and `working-directory` options for all [`run`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun) steps in a job. You can also set default settings for `run` for the entire workflow. For more information, see [`defaults.run`](/actions/using-workflows/workflow-syntax-for-github-actions#defaultsrun). +These can be overriden at the `jobs..defaults.run` and `jobs..steps[*].run` levels. + {% data reusables.actions.defaults-override %} diff --git a/data/reusables/actions/jobs/working-directory-must-exist.md b/data/reusables/actions/jobs/working-directory-must-exist.md new file mode 100644 index 0000000000000..55e987efb1655 --- /dev/null +++ b/data/reusables/actions/jobs/working-directory-must-exist.md @@ -0,0 +1,6 @@ +{% note %} + +**Note:** If the `working-directory` does not exist, the step will probably fail to run the `shell`. + +{% endnote %} + diff --git a/data/reusables/actions/reusable-keyword.md b/data/reusables/actions/reusable-keyword.md new file mode 100644 index 0000000000000..2bb027f607ecd --- /dev/null +++ b/data/reusables/actions/reusable-keyword.md @@ -0,0 +1,2 @@ + This keyword can reference several contexts. For more information, see "[Contexts](/actions/learn-github-actions/contexts#context-availability)." + \ No newline at end of file diff --git a/data/reusables/actions/supported-shells.md b/data/reusables/actions/supported-shells.md new file mode 100644 index 0000000000000..8189709701e42 --- /dev/null +++ b/data/reusables/actions/supported-shells.md @@ -0,0 +1,10 @@ +| Supported platform | `shell` parameter | Description | Command run internally | +| ------------------ | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- | +| Linux / macOS | unspecified | The default shell on non-Windows platforms. Note that this runs a different command to when `bash` is specified explicitly. If `bash` is not found in the path, this is treated as `sh`. | `bash -e {0}` | +| All | `bash` | The default shell on non-Windows platforms with a fallback to `sh`. When specifying a bash shell on Windows, the bash shell included with Git for Windows is used. | `bash --noprofile --norc -eo pipefail {0}` | +| All | `pwsh` | The PowerShell Core. {% data variables.product.prodname_dotcom %} appends the extension `.ps1` to your script name. | `pwsh -command ". '{0}'"` | +| All | `python` | Executes the python command. | `python {0}` | +| Linux / macOS | `sh` | The fallback behavior for non-Windows platforms if no shell is provided and `bash` is not found in the path. | `sh -e {0}` | +| Windows | `cmd` | {% data variables.product.prodname_dotcom %} appends the extension `.cmd` to your script name and substitutes for `{0}`. | `%ComSpec% /D /E:ON /V:OFF /S /C "CALL "{0}""`. | +| Windows | `pwsh` | This is the default shell used on Windows. The PowerShell Core. {% data variables.product.prodname_dotcom %} appends the extension `.ps1` to your script name. If your self-hosted Windows runner does not have _PowerShell Core_ installed, then _PowerShell Desktop_ is used instead. | `pwsh -command ". '{0}'"`. | +| Windows | `powershell` | The PowerShell Desktop. {% data variables.product.prodname_dotcom %} appends the extension `.ps1` to your script name. | `powershell -command ". '{0}'"`. | From 1516c64e63b95c94ec9939435f5a15d9428188d5 Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Wed, 6 Mar 2024 09:06:29 -0500 Subject: [PATCH 2/9] Fix some of the errors caunt by linter --- .../using-workflows/workflow-syntax-for-github-actions.md | 4 ++-- ...etting-default-values-for-jobs-defaults-job-run-shell.md | 6 +++--- ...lt-values-for-jobs-defaults-job-run-working-directory.md | 6 +++--- data/reusables/actions/reusable-keyword.md | 3 +-- .../actions/{jobs => }/working-directory-must-exist.md | 3 +-- 5 files changed, 10 insertions(+), 12 deletions(-) rename data/reusables/actions/{jobs => }/working-directory-must-exist.md (70%) diff --git a/content/actions/using-workflows/workflow-syntax-for-github-actions.md b/content/actions/using-workflows/workflow-syntax-for-github-actions.md index cbbb3e7faef97..ae2887166475e 100644 --- a/content/actions/using-workflows/workflow-syntax-for-github-actions.md +++ b/content/actions/using-workflows/workflow-syntax-for-github-actions.md @@ -266,11 +266,11 @@ env: ## `defaults.run.shell` -{% data reusables.actions.jobs.setting-default-values-for-jobs-defaults-run-shell %} +{% data reusables.actions.setting-default-values-for-jobs-defaults-run-shell %} ## `defaults.run.working-directory` -{% data reusables.actions.jobs.setting-default-values-for-jobs-defaults-run-working-directory %} +{% data reusables.actions.setting-default-values-for-jobs-defaults-run-working-directory %} ## `concurrency` diff --git a/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-job-run-shell.md b/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-job-run-shell.md index 06f2b0a6aebf4..884d226bd2275 100644 --- a/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-job-run-shell.md +++ b/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-job-run-shell.md @@ -3,8 +3,8 @@ Use `shell` to define the `shell` for a step. {% data reusables.actions.reusable {% data reusables.actions.supported-shells %} The `shell` for a step is taken from the first defined in this list: -1. the step `jobs..steps[*].run.shell`. See [`jobs..steps[*].shell`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell). -1. the job `jobs..defaults.run.shell`. See [`jobs..defaults.run.shell`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_iddefaultsrunshell). -1. the workflow `defaults.run.shell`. See [`defaults.run.shell`](/actions/using-workflows/workflow-syntax-for-github-actions#defaultsrunshell). +1. The step `jobs..steps[*].run.shell`. See [`jobs..steps[*].shell`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell). +1. The job `jobs..defaults.run.shell`. See [`jobs..defaults.run.shell`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_iddefaultsrunshell). +1. The workflow `defaults.run.shell`. See [`defaults.run.shell`](/actions/using-workflows/workflow-syntax-for-github-actions#defaultsrunshell). {% data reusables.actions.defaults-override %} diff --git a/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-job-run-working-directory.md b/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-job-run-working-directory.md index 598bc849ae192..595006de96c75 100644 --- a/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-job-run-working-directory.md +++ b/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-job-run-working-directory.md @@ -3,8 +3,8 @@ Use `working-directory` to define the working directory for the `shell` for a st {% data reusables.actions.working-directory-must-exist %} The `working-directory` for a step is taken from the first defined in this list: -1. the step `jobs..steps[*].run.working-directory`. See [`jobs..steps[*].working-directory`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsworking-directory). -1. the job `jobs..defaults.run.working-directory`. See [`jobs..defaults.run.working-directory`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_iddefaultsrunworkingdirectory). -1. the workflow `defaults.run.working-directory`. See [`defaults.run.working-directory`](/actions/using-workflows/workflow-syntax-for-github-actions#defaultsrunworkingdirectory). +1. The step `jobs..steps[*].run.working-directory`. See [`jobs..steps[*].working-directory`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsworking-directory). +1. The job `jobs..defaults.run.working-directory`. See [`jobs..defaults.run.working-directory`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_iddefaultsrunworkingdirectory). +1. The workflow `defaults.run.working-directory`. See [`defaults.run.working-directory`](/actions/using-workflows/workflow-syntax-for-github-actions#defaultsrunworkingdirectory). {% data reusables.actions.defaults-override %} diff --git a/data/reusables/actions/reusable-keyword.md b/data/reusables/actions/reusable-keyword.md index 2bb027f607ecd..a91ec70ae60c0 100644 --- a/data/reusables/actions/reusable-keyword.md +++ b/data/reusables/actions/reusable-keyword.md @@ -1,2 +1 @@ - This keyword can reference several contexts. For more information, see "[Contexts](/actions/learn-github-actions/contexts#context-availability)." - \ No newline at end of file +This keyword can reference several contexts. For more information, see "[Contexts](/actions/learn-github-actions/contexts#context-availability)." diff --git a/data/reusables/actions/jobs/working-directory-must-exist.md b/data/reusables/actions/working-directory-must-exist.md similarity index 70% rename from data/reusables/actions/jobs/working-directory-must-exist.md rename to data/reusables/actions/working-directory-must-exist.md index 55e987efb1655..7511a25f2569c 100644 --- a/data/reusables/actions/jobs/working-directory-must-exist.md +++ b/data/reusables/actions/working-directory-must-exist.md @@ -1,6 +1,5 @@ {% note %} -**Note:** If the `working-directory` does not exist, the step will probably fail to run the `shell`. +**Note:** If the `working-directory` does not exist, the step will probably fail to run the `shell`. {% endnote %} - From 9ce845c7fdda430cf699652cbc54c963aec252b3 Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Wed, 6 Mar 2024 11:39:40 -0500 Subject: [PATCH 3/9] Reuse reusable run parameters --- .../using-workflows/workflow-syntax-for-github-actions.md | 4 ++-- ... => setting-default-values-for-jobs-defaults-run-shell.md} | 0 ...default-values-for-jobs-defaults-run-working-directory.md} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename data/reusables/actions/jobs/{setting-default-values-for-jobs-defaults-job-run-shell.md => setting-default-values-for-jobs-defaults-run-shell.md} (100%) rename data/reusables/actions/jobs/{setting-default-values-for-jobs-defaults-job-run-working-directory.md => setting-default-values-for-jobs-defaults-run-working-directory.md} (100%) diff --git a/content/actions/using-workflows/workflow-syntax-for-github-actions.md b/content/actions/using-workflows/workflow-syntax-for-github-actions.md index ae2887166475e..638ed41ae8067 100644 --- a/content/actions/using-workflows/workflow-syntax-for-github-actions.md +++ b/content/actions/using-workflows/workflow-syntax-for-github-actions.md @@ -355,11 +355,11 @@ jobs: ## `jobs..defaults.run.shell` -{% data reusables.actions.jobs.setting-default-values-for-jobs-defaults-job-run-shell %} +{% data reusables.actions.jobs.setting-default-values-for-jobs-defaults-run-shell %} ## `jobs..defaults.run.working-directory` -{% data reusables.actions.jobs.setting-default-values-for-jobs-defaults-job-run-working-directory %} +{% data reusables.actions.jobs.setting-default-values-for-jobs-defaults-run-working-directory %} ### Example: Setting default `run` step options for a job diff --git a/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-job-run-shell.md b/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-run-shell.md similarity index 100% rename from data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-job-run-shell.md rename to data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-run-shell.md diff --git a/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-job-run-working-directory.md b/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-run-working-directory.md similarity index 100% rename from data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-job-run-working-directory.md rename to data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-run-working-directory.md From 060ff66783c9e6f03694d64575450dd4d9a804a9 Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Wed, 6 Mar 2024 14:32:45 -0500 Subject: [PATCH 4/9] Use nested path --- .../using-workflows/workflow-syntax-for-github-actions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/actions/using-workflows/workflow-syntax-for-github-actions.md b/content/actions/using-workflows/workflow-syntax-for-github-actions.md index 638ed41ae8067..68e8883221948 100644 --- a/content/actions/using-workflows/workflow-syntax-for-github-actions.md +++ b/content/actions/using-workflows/workflow-syntax-for-github-actions.md @@ -266,11 +266,11 @@ env: ## `defaults.run.shell` -{% data reusables.actions.setting-default-values-for-jobs-defaults-run-shell %} +{% data reusables.actions.jobs.setting-default-values-for-jobs-defaults-run-shell %} ## `defaults.run.working-directory` -{% data reusables.actions.setting-default-values-for-jobs-defaults-run-working-directory %} +{% data reusables.actions.jobs.setting-default-values-for-jobs-defaults-run-working-directory %} ## `concurrency` From 675be51a61d6939df88b2ccc4e9147ce44a9419a Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Thu, 7 Mar 2024 16:20:01 -0500 Subject: [PATCH 5/9] Add missing dashes --- ...-default-values-for-jobs-defaults-run-working-directory.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-run-working-directory.md b/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-run-working-directory.md index 595006de96c75..59298e1ddb48b 100644 --- a/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-run-working-directory.md +++ b/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-run-working-directory.md @@ -4,7 +4,7 @@ Use `working-directory` to define the working directory for the `shell` for a st The `working-directory` for a step is taken from the first defined in this list: 1. The step `jobs..steps[*].run.working-directory`. See [`jobs..steps[*].working-directory`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsworking-directory). -1. The job `jobs..defaults.run.working-directory`. See [`jobs..defaults.run.working-directory`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_iddefaultsrunworkingdirectory). -1. The workflow `defaults.run.working-directory`. See [`defaults.run.working-directory`](/actions/using-workflows/workflow-syntax-for-github-actions#defaultsrunworkingdirectory). +1. The job `jobs..defaults.run.working-directory`. See [`jobs..defaults.run.working-directory`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_iddefaultsrunworking-directory). +1. The workflow `defaults.run.working-directory`. See [`defaults.run.working-directory`](/actions/using-workflows/workflow-syntax-for-github-actions#defaultsrunworking-directory). {% data reusables.actions.defaults-override %} From f1f2b65c809d95fb67fa7e63ec308c65c04955cf Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Thu, 7 Mar 2024 16:38:41 -0500 Subject: [PATCH 6/9] Add more dashes --- .../using-workflows/workflow-syntax-for-github-actions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/actions/using-workflows/workflow-syntax-for-github-actions.md b/content/actions/using-workflows/workflow-syntax-for-github-actions.md index 68e8883221948..f61564f223c84 100644 --- a/content/actions/using-workflows/workflow-syntax-for-github-actions.md +++ b/content/actions/using-workflows/workflow-syntax-for-github-actions.md @@ -632,7 +632,7 @@ Using the `working-directory` keyword, you can specify the working directory of working-directory: ./temp ``` -Alternatively, you can specify a default working directory for all `run` steps in a job, or for all `run` steps in the entire workflow. For more information, see "[`defaults.run.working-directory`](/actions/using-workflows/workflow-syntax-for-github-actions#defaultsrunworkingdirectory)" and "[`jobs..defaults.run.working-directory`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_iddefaultsrunworkingdirectory)." +Alternatively, you can specify a default working directory for all `run` steps in a job, or for all `run` steps in the entire workflow. For more information, see "[`defaults.run.working-directory`](/actions/using-workflows/workflow-syntax-for-github-actions#defaultsrunworking-directory)" and "[`jobs..defaults.run.working-directory`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_iddefaultsrunworking-directory)." You can also use a `run` step to run a script. For more information, see "[AUTOTITLE](/actions/learn-github-actions/essential-features-of-github-actions#adding-scripts-to-your-workflow)." From 51a17566272baa40b6e8600398bf7a4398e688b5 Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Tue, 12 Mar 2024 16:48:32 -0400 Subject: [PATCH 7/9] Apply suggestions from code review Co-authored-by: Siara <108543037+SiaraMist@users.noreply.github.com> --- .../setting-default-values-for-jobs-defaults-run-shell.md | 4 ---- ...-default-values-for-jobs-defaults-run-working-directory.md | 4 ---- data/reusables/actions/working-directory-must-exist.md | 2 +- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-run-shell.md b/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-run-shell.md index 884d226bd2275..bb2be64604c9d 100644 --- a/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-run-shell.md +++ b/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-run-shell.md @@ -2,9 +2,5 @@ Use `shell` to define the `shell` for a step. {% data reusables.actions.reusable {% data reusables.actions.supported-shells %} -The `shell` for a step is taken from the first defined in this list: -1. The step `jobs..steps[*].run.shell`. See [`jobs..steps[*].shell`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell). -1. The job `jobs..defaults.run.shell`. See [`jobs..defaults.run.shell`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_iddefaultsrunshell). -1. The workflow `defaults.run.shell`. See [`defaults.run.shell`](/actions/using-workflows/workflow-syntax-for-github-actions#defaultsrunshell). {% data reusables.actions.defaults-override %} diff --git a/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-run-working-directory.md b/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-run-working-directory.md index 59298e1ddb48b..a7f124ba4bcb0 100644 --- a/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-run-working-directory.md +++ b/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-run-working-directory.md @@ -2,9 +2,5 @@ Use `working-directory` to define the working directory for the `shell` for a st {% data reusables.actions.working-directory-must-exist %} -The `working-directory` for a step is taken from the first defined in this list: -1. The step `jobs..steps[*].run.working-directory`. See [`jobs..steps[*].working-directory`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsworking-directory). -1. The job `jobs..defaults.run.working-directory`. See [`jobs..defaults.run.working-directory`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_iddefaultsrunworking-directory). -1. The workflow `defaults.run.working-directory`. See [`defaults.run.working-directory`](/actions/using-workflows/workflow-syntax-for-github-actions#defaultsrunworking-directory). {% data reusables.actions.defaults-override %} diff --git a/data/reusables/actions/working-directory-must-exist.md b/data/reusables/actions/working-directory-must-exist.md index 7511a25f2569c..2c7a381ba1623 100644 --- a/data/reusables/actions/working-directory-must-exist.md +++ b/data/reusables/actions/working-directory-must-exist.md @@ -1,5 +1,5 @@ {% note %} -**Note:** If the `working-directory` does not exist, the step will probably fail to run the `shell`. +**Tip:** Ensure the `working-directory` you assign exists on the runner before you run your shell in it. {% endnote %} From 826a80a1a9d95fc0168d58633a0fa26a56007ef3 Mon Sep 17 00:00:00 2001 From: Siara <108543037+SiaraMist@users.noreply.github.com> Date: Tue, 12 Mar 2024 13:53:06 -0700 Subject: [PATCH 8/9] Update data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-run-shell.md --- .../jobs/setting-default-values-for-jobs-defaults-run-shell.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-run-shell.md b/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-run-shell.md index bb2be64604c9d..d233a30cbc8b7 100644 --- a/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-run-shell.md +++ b/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-run-shell.md @@ -1,6 +1,4 @@ Use `shell` to define the `shell` for a step. {% data reusables.actions.reusable-keyword %} {% data reusables.actions.supported-shells %} - - {% data reusables.actions.defaults-override %} From 6fda9ad6d5809dea2a2d78e6923de55a3e46e782 Mon Sep 17 00:00:00 2001 From: Siara <108543037+SiaraMist@users.noreply.github.com> Date: Tue, 12 Mar 2024 13:53:32 -0700 Subject: [PATCH 9/9] Update data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-run-working-directory.md --- ...ng-default-values-for-jobs-defaults-run-working-directory.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-run-working-directory.md b/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-run-working-directory.md index a7f124ba4bcb0..fe875ca479035 100644 --- a/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-run-working-directory.md +++ b/data/reusables/actions/jobs/setting-default-values-for-jobs-defaults-run-working-directory.md @@ -1,6 +1,4 @@ Use `working-directory` to define the working directory for the `shell` for a step. {% data reusables.actions.reusable-keyword %} {% data reusables.actions.working-directory-must-exist %} - - {% data reusables.actions.defaults-override %}