2424 shell : bash
2525 env :
2626 REQUESTED_VERSION : ${{ inputs.Version }}
27+ GITHUB_TOKEN : ${{ github.token }}
2728 run : |
2829 set -e
2930
3334 case "${REQUESTED_VERSION:-}" in
3435 [Ll][Aa][Tt][Ee][Ss][Tt])
3536 REQUESTED_VERSION=$(
36- curl -s -f https://api.github.com/repos/PowerShell/PowerShell/releases/latest |
37+ curl -s -f \
38+ -H "Accept: application/vnd.github+json" \
39+ -H "Authorization: Bearer $GITHUB_TOKEN" \
40+ -H "X-GitHub-Api-Version: 2022-11-28" \
41+ https://api.github.com/repos/PowerShell/PowerShell/releases/latest |
3742 jq -r '.tag_name' | sed 's/^v//'
3843 )
3944 echo "Latest stable PowerShell release detected: $REQUESTED_VERSION"
8489 shell : bash
8590 env :
8691 REQUESTED_VERSION : ${{ inputs.Version }}
92+ GITHUB_TOKEN : ${{ github.token }}
8793 run : |
8894 set -e
8995
@@ -95,7 +101,11 @@ runs:
95101 # Only resolve to latest version if explicitly set to 'latest'
96102 if [[ "$REQ_VER_LOWER" == "latest" ]]; then
97103 REQUESTED_VERSION=$(
98- curl -s -f https://api.github.com/repos/PowerShell/PowerShell/releases/latest |
104+ curl -s -f \
105+ -H "Accept: application/vnd.github+json" \
106+ -H "Authorization: Bearer $GITHUB_TOKEN" \
107+ -H "X-GitHub-Api-Version: 2022-11-28" \
108+ https://api.github.com/repos/PowerShell/PowerShell/releases/latest |
99109 jq -r '.tag_name' | sed 's/^v//'
100110 )
101111 echo "Latest stable PowerShell release detected: $REQUESTED_VERSION"
@@ -157,7 +167,14 @@ runs:
157167 # Only resolve to latest version if explicitly set to 'latest' (case-insensitive)
158168 $req = $env:REQUESTED_VERSION
159169 if ($req -and $req.Trim().ToLower() -eq 'latest') {
160- $latest = (Invoke-RestMethod -Uri 'https://api.github.com/repos/PowerShell/PowerShell/releases/latest').tag_name.TrimStart('v')
170+ $latest = (
171+ Invoke-RestMethod -Uri 'https://api.github.com/repos/PowerShell/PowerShell/releases/latest' `
172+ -Headers @{
173+ 'Accept' = 'application/vnd.github+json'
174+ 'Authorization' = "Bearer $($env:GITHUB_TOKEN)"
175+ 'X-GitHub-Api-Version' = '2022-11-28'
176+ }
177+ ).tag_name.TrimStart('v')
161178 Write-Host "Latest stable PowerShell release detected: $latest"
162179 $env:REQUESTED_VERSION = $latest
163180 } elseif ([string]::IsNullOrWhiteSpace($req)) {
0 commit comments