Use GH token to download Podman release in utils.ps1

This is to avoid requests failing due to GitHub's non-authenticated
request rate limit.

See [this PR check
failure](https://github.com/podman-container-tools/podman-sandbox/actions/runs/26632208486/job/78483599334?pr=5)
for an example of such a failure.

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
This commit is contained in:
Mario Loriedo
2026-05-29 13:40:02 +02:00
parent 2393c05d28
commit 7c7d56a0fb

View File

@@ -17,7 +17,11 @@ function Get-Podman-Setup-From-GitHub {
Write-Host "Downloading the $arch $version Podman windows setup from GitHub..."
$apiUrl = "https://api.github.com/repos/containers/podman/releases/$version"
$response = Invoke-RestMethod -Uri $apiUrl -Headers @{"User-Agent"="PowerShell"} -ErrorAction Stop
$headers = @{"User-Agent"="PowerShell"}
if ($env:GITHUB_TOKEN) {
$headers["Authorization"] = "Bearer $env:GITHUB_TOKEN"
}
$response = Invoke-RestMethod -Uri $apiUrl -Headers $headers -ErrorAction Stop
$latestTag = $response.tag_name
Write-Host "Looking for an asset named ""podman-installer-windows-$arch.exe"""
$downloadAsset = $response.assets | Where-Object { $_.name -eq "podman-installer-windows-$arch.exe" } | Select-Object -First 1