Find installed PowerShell on Windows runner
This commit is contained in:
1 parent
3632d4b67d
commit
23ab34ab72
1 file changed
+9
@@ -57,6 +57,15 @@ jobs:
|
|||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
|
- name: Find PowerShell 7 on Windows runner
|
||||||
|
shell: powershell
|
||||||
|
run: |
|
||||||
|
$pwsh = (Get-Command pwsh -ErrorAction SilentlyContinue | Select-Object -First 1).Source
|
||||||
|
if (-not $pwsh) { $pwsh = Join-Path $env:ProgramFiles 'PowerShell\7\pwsh.exe' }
|
||||||
|
if (-not (Test-Path $pwsh)) { throw "PowerShell 7 is not available to the runner at $pwsh" }
|
||||||
|
$version = & $pwsh -NoProfile -Command '$PSVersionTable.PSVersion.ToString()'
|
||||||
|
Write-Host "Using PowerShell $version at $pwsh"
|
||||||
|
Add-Content -Path $env:GITEA_PATH -Value (Split-Path $pwsh)
|
||||||
- name: Verify Windows runner
|
- name: Verify Windows runner
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
Reference in new issue
Block a user