Skip to content

Commit dced9c9

Browse files
committed
lookup release by id not name
1 parent 55e7bb0 commit dced9c9

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

packages/desktop/scripts/finalize-latest-json.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ const dryRun = values["dry-run"]
1616
const repo = process.env.GH_REPO
1717
if (!repo) throw new Error("GH_REPO is required")
1818

19+
const releaseId = process.env.OPENCODE_RELEASE
20+
if (!releaseId) throw new Error("OPENCODE_RELEASE is required")
21+
1922
const version = process.env.OPENCODE_VERSION
2023
if (!version) throw new Error("OPENCODE_VERSION is required")
2124

@@ -26,6 +29,19 @@ const root = dir
2629
const token = process.env.GH_TOKEN ?? process.env.GITHUB_TOKEN
2730
if (!token) throw new Error("GH_TOKEN or GITHUB_TOKEN is required")
2831

32+
const apiHeaders = {
33+
Authorization: `token ${token}`,
34+
Accept: "application/vnd.github+json",
35+
}
36+
37+
const releaseRes = await fetch(`https://api.github.com/repos/${repo}/releases/${releaseId}`, {
38+
headers: apiHeaders,
39+
})
40+
41+
if (!releaseRes.ok) {
42+
throw new Error(`Failed to fetch release: ${releaseRes.status} ${releaseRes.statusText}`)
43+
}
44+
2945
type Asset = {
3046
name: string
3147
url: string

0 commit comments

Comments
 (0)