Skip to content

Commit 3b6bf84

Browse files
committed
fix(install.ps1): resolve latest version via GitHub REST API
PowerShell 7 (the shell on GitHub's windows runners) treats GitHub's 302 redirect on /releases/latest as a terminating error under -MaximumRedirection 0, breaking version resolution. Query the REST API for tag_name instead. Caught by the new installer smoke-test workflow.
1 parent f77aa30 commit 3b6bf84

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

install.ps1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ function Get-NativeAsset([string]$Arch) {
3535

3636
# ── version ───────────────────────────────────────────────────────────────────
3737
function Get-LatestVersion {
38-
$resp = Invoke-WebRequest -Uri "https://github.com/$Repo/releases/latest" `
39-
-MaximumRedirection 0 -ErrorAction SilentlyContinue
40-
$resp.Headers['Location'] -replace '.*/releases/tag/', ''
38+
# GitHub's /releases/latest is a 302 redirect. PowerShell 7 treats a 3xx
39+
# response under -MaximumRedirection 0 as a terminating error, so resolve the
40+
# tag via the REST API instead, which returns it directly.
41+
(Invoke-RestMethod -Uri "https://api.github.com/repos/$Repo/releases/latest").tag_name
4142
}
4243

4344
# ── java detection ────────────────────────────────────────────────────────────

0 commit comments

Comments
 (0)