fix: set sh as default shell for containers (#853)
* fix: set default shell for containers to sh This matches GitHub Actions behaviour where, runners use bash since it's guaranteed to exist there while containers use sh for compatibility * tests: fixup for default shell
This commit is contained in:
@@ -183,6 +183,7 @@ func (sc *StepContext) setupEnv(ctx context.Context) (ExpressionEvaluator, error
|
||||
return evaluator, nil
|
||||
}
|
||||
|
||||
// nolint:gocyclo
|
||||
func (sc *StepContext) setupShellCommand() common.Executor {
|
||||
rc := sc.RunContext
|
||||
step := sc.Step
|
||||
@@ -237,6 +238,11 @@ func (sc *StepContext) setupShellCommand() common.Executor {
|
||||
if step.Shell == "" {
|
||||
step.Shell = rc.Run.Workflow.Defaults.Run.Shell
|
||||
}
|
||||
if rc.Run.Job().Container() != nil {
|
||||
if rc.Run.Job().Container().Image != "" && step.Shell == "" {
|
||||
step.Shell = "sh"
|
||||
}
|
||||
}
|
||||
scCmd := step.ShellCommand()
|
||||
|
||||
var finalCMD []string
|
||||
|
||||
Reference in New Issue
Block a user