-
Notifications
You must be signed in to change notification settings - Fork 63.5k
Description
Code of Conduct
- I have read and agree to the GitHub Docs project's Code of Conduct
What article on docs.github.com is affected?
https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
What part(s) of the article would you like to see updated?
The jobs.<job_id>.steps[*].shell
lists the default shell commands for Linux/macOS under Command run internally column:
shell | command |
---|---|
unspecified | bash -e {0} |
bash |
bash --noprofile --norc -eo pipefail {0} |
sh |
sh -e {0} |
Screenshot of a test run from ubuntu-latest
/ubuntu-22.04
runner:
All these variants have -e
and according to its description under The Set Builtin section form the Bash manual:
-e
: Exit immediately if a pipeline (see Pipelines), which may consist of a single simple command (see Simple Commands), a list (see Lists of Commands), or a compound command (see Compound Commands) returns a non-zero status.
Which is equivalent to the fail fast behavior.
But, according to the Exit codes and error action preference:
bash
/sh
: Fail-fast behavior usingset -eo pipefail
: This option is set whenshell: bash
is explicitly specified. It is not applied by default.
And, that is not the case. This only applies to the -o pipefail
part (Bash only) because -e
is applied by default.
The -o pipeline
only affects the returning of the exit status from Pipelines in Bash:
pipefail
: If set, the return value of a pipeline is the value of the last (rightmost) command to exit with a non-zero status, or zero if all commands in the pipeline exit successfully.
The docs should be revised to avoid contradiction when both these sections are read in conjunction.
-e
is applied by default tosh
andbash
both.-o pipefail
is applied tobash
only (i.e.bash -e -o pipefail
) whenshell: bash
is specified; and, not toshell: sh
.sh
command should also havepipefail
but at the moment it doesn't. Also, it has a different syntax i.e.sh -e -pipefail
.