Commit d9ea33a 1 parent f75a2d8 commit d9ea33a Copy full SHA for d9ea33a
File tree 2 files changed +17
-7
lines changed
2 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -572,6 +572,8 @@ type Step struct {
572
572
Uses string `yaml:"uses"`
573
573
Run string `yaml:"run"`
574
574
WorkingDirectory string `yaml:"working-directory"`
575
+ // WorkflowShell is the shell really configured in the job, directly at step level or higher in defaults.run.shell
576
+ WorkflowShell string
575
577
Shell string `yaml:"shell"`
576
578
Env yaml.Node `yaml:"env"`
577
579
With map [string ]string `yaml:"with"`
@@ -614,8 +616,14 @@ func (s *Step) ShellCommand() string {
614
616
615
617
//Reference: https://github.com/actions/runner/blob/8109c962f09d9acc473d92c595ff43afceddb347/src/Runner.Worker/Handlers/ScriptHandlerHelpers.cs#L9-L17
616
618
switch s .Shell {
617
- case "" , "bash" :
618
- shellCommand = "bash --noprofile --norc -e -o pipefail {0}"
619
+ case "" :
620
+ shellCommand = "bash -e {0}"
621
+ case "bash" :
622
+ if s .WorkflowShell == "" {
623
+ shellCommand = "bash -e {0}"
624
+ } else {
625
+ shellCommand = "bash --noprofile --norc -e -o pipefail {0}"
626
+ }
619
627
case "pwsh" :
620
628
shellCommand = "pwsh -command . '{0}'"
621
629
case "python" :
Original file line number Diff line number Diff line change @@ -166,16 +166,16 @@ func (sr *stepRun) setupShell(ctx context.Context) {
166
166
step := sr .Step
167
167
168
168
if step .Shell == "" {
169
- step .Shell = rc .Run .Job ().Defaults .Run .Shell
169
+ step .WorkflowShell = rc .Run .Job ().Defaults .Run .Shell
170
170
}
171
171
172
- step .Shell = rc .NewExpressionEvaluator (ctx ).Interpolate (ctx , step .Shell )
172
+ step .WorkflowShell = rc .NewExpressionEvaluator (ctx ).Interpolate (ctx , step .Shell )
173
173
174
- if step .Shell == "" {
175
- step .Shell = rc .Run .Workflow .Defaults .Run .Shell
174
+ if step .WorkflowShell == "" {
175
+ step .WorkflowShell = rc .Run .Workflow .Defaults .Run .Shell
176
176
}
177
177
178
- if step .Shell == "" {
178
+ if step .WorkflowShell == "" {
179
179
if _ , ok := rc .JobContainer .(* container.HostEnvironment ); ok {
180
180
shellWithFallback := []string {"bash" , "sh" }
181
181
// Don't use bash on windows by default, if not using a docker container
@@ -196,6 +196,8 @@ func (sr *stepRun) setupShell(ctx context.Context) {
196
196
// Currently only linux containers are supported, use sh by default like actions/runner
197
197
step .Shell = "sh"
198
198
}
199
+ } else {
200
+ step .Shell = step .WorkflowShell
199
201
}
200
202
}
201
203
You can’t perform that action at this time.
0 commit comments