mirror of
https://github.com/github/codeql.git
synced 2026-01-10 13:10:26 +01:00
Add pwsh as the default shell for windows runners
This commit is contained in:
@@ -1438,12 +1438,18 @@ class RunImpl extends StepImpl {
|
||||
|
||||
/** Gets the shell for this `run` mapping. */
|
||||
string getShell() {
|
||||
if exists(n.lookup("shell").(YamlString).getValue())
|
||||
if exists(n.lookup("shell"))
|
||||
then result = n.lookup("shell").(YamlString).getValue()
|
||||
else
|
||||
if exists(this.getInScopeDefaultValue("run", "shell"))
|
||||
then result = this.getInScopeDefaultValue("run", "shell").getValue()
|
||||
else result = "bash"
|
||||
else
|
||||
if this.getEnclosingJob().getARunsOnLabel().matches(["ubuntu%", "macos%"])
|
||||
then result = "bash"
|
||||
else
|
||||
if this.getEnclosingJob().getARunsOnLabel().matches("windows%")
|
||||
then result = "pwsh"
|
||||
else result = "bash"
|
||||
}
|
||||
|
||||
ShellScriptImpl getScript() { result = scriptScalar }
|
||||
|
||||
23
ql/test/library-tests/.github/workflows/shell.yml
vendored
Normal file
23
ql/test/library-tests/.github/workflows/shell.yml
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
job1:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- shell: pwsh
|
||||
run: Write-Output "foo"
|
||||
job2:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: echo "foo"
|
||||
|
||||
job3:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- shell: bash
|
||||
run: echo "foo"
|
||||
job4:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- run: Write-Output "foo"
|
||||
|
||||
Reference in New Issue
Block a user