File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,6 +16,9 @@ const dryRun = values["dry-run"]
1616const repo = process . env . GH_REPO
1717if ( ! 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+
1922const version = process . env . OPENCODE_VERSION
2023if ( ! version ) throw new Error ( "OPENCODE_VERSION is required" )
2124
@@ -26,6 +29,19 @@ const root = dir
2629const token = process . env . GH_TOKEN ?? process . env . GITHUB_TOKEN
2730if ( ! 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+
2945type Asset = {
3046 name : string
3147 url : string
You can’t perform that action at this time.
0 commit comments