File tree Expand file tree Collapse file tree
lib/codeql/actions/ast/internal
test/library-tests/.github/workflows Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1438,12 +1438,18 @@ class RunImpl extends StepImpl {
14381438
14391439 /** Gets the shell for this `run` mapping. */
14401440 string getShell ( ) {
1441- if exists ( n .lookup ( "shell" ) . ( YamlString ) . getValue ( ) )
1441+ if exists ( n .lookup ( "shell" ) )
14421442 then result = n .lookup ( "shell" ) .( YamlString ) .getValue ( )
14431443 else
14441444 if exists ( this .getInScopeDefaultValue ( "run" , "shell" ) )
14451445 then result = this .getInScopeDefaultValue ( "run" , "shell" ) .getValue ( )
1446- else result = "bash"
1446+ else
1447+ if this .getEnclosingJob ( ) .getARunsOnLabel ( ) .matches ( [ "ubuntu%" , "macos%" ] )
1448+ then result = "bash"
1449+ else
1450+ if this .getEnclosingJob ( ) .getARunsOnLabel ( ) .matches ( "windows%" )
1451+ then result = "pwsh"
1452+ else result = "bash"
14471453 }
14481454
14491455 ShellScriptImpl getScript ( ) { result = scriptScalar }
Original file line number Diff line number Diff line change 1+ on : push
2+
3+ jobs :
4+ job1 :
5+ runs-on : ubuntu-latest
6+ steps :
7+ - shell : pwsh
8+ run : Write-Output "foo"
9+ job2 :
10+ runs-on : ubuntu-latest
11+ steps :
12+ - run : echo "foo"
13+
14+ job3 :
15+ runs-on : windows-latest
16+ steps :
17+ - shell : bash
18+ run : echo "foo"
19+ job4 :
20+ runs-on : windows-latest
21+ steps :
22+ - run : Write-Output "foo"
23+
You can’t perform that action at this time.
0 commit comments