* bash without "-o pipefail" option when "bash" is not explicitely defined in the workflow * bonus: fix inverted expected and actual in TestGetGitHubContext assertions
This commit is contained in:
committed by
GitHub
parent
013c0d4e18
commit
2e117a4d2b
@@ -572,6 +572,8 @@ type Step struct {
|
||||
Uses string `yaml:"uses"`
|
||||
Run string `yaml:"run"`
|
||||
WorkingDirectory string `yaml:"working-directory"`
|
||||
// WorkflowShell is the shell really configured in the job, directly at step level or higher in defaults.run.shell
|
||||
WorkflowShell string `yaml:"-"`
|
||||
Shell string `yaml:"shell"`
|
||||
Env yaml.Node `yaml:"env"`
|
||||
With map[string]string `yaml:"with"`
|
||||
@@ -614,8 +616,14 @@ func (s *Step) ShellCommand() string {
|
||||
|
||||
//Reference: https://github.com/actions/runner/blob/8109c962f09d9acc473d92c595ff43afceddb347/src/Runner.Worker/Handlers/ScriptHandlerHelpers.cs#L9-L17
|
||||
switch s.Shell {
|
||||
case "", "bash":
|
||||
shellCommand = "bash --noprofile --norc -e -o pipefail {0}"
|
||||
case "":
|
||||
shellCommand = "bash -e {0}"
|
||||
case "bash":
|
||||
if s.WorkflowShell == "" {
|
||||
shellCommand = "bash -e {0}"
|
||||
} else {
|
||||
shellCommand = "bash --noprofile --norc -e -o pipefail {0}"
|
||||
}
|
||||
case "pwsh":
|
||||
shellCommand = "pwsh -command . '{0}'"
|
||||
case "python":
|
||||
|
||||
Reference in New Issue
Block a user