@@ -14,8 +14,7 @@ if (process.env.GH_TOKEN == null) {
1414 process . exit ( 1 ) ;
1515}
1616
17- const OWNER = 'facebook' ;
18- const REPO = 'react' ;
17+ const repository = 'eps1lon/react' ;
1918const WORKFLOW_ID = 'runtime_build_and_test.yml' ;
2019const GITHUB_HEADERS = `
2120 -H "Accept: application/vnd.github+json" \
@@ -48,16 +47,15 @@ function getWorkflowId() {
4847}
4948
5049async function getWorkflowRun ( commit ) {
51- const res = await exec (
52- `curl -L ${ GITHUB_HEADERS } https://api.github.com/repos/${ OWNER } /${ REPO } /actions/workflows/${ getWorkflowId ( ) } /runs?head_sha=${ commit } `
53- ) ;
50+ const url = `https://api.github.com/repos/${ repository } /actions/workflows/${ getWorkflowId ( ) } /runs?head_sha=${ commit } ` ;
51+ const res = await exec ( `curl -L ${ GITHUB_HEADERS } ${ url } ` ) ;
5452
5553 const json = JSON . parse ( res . stdout ) ;
5654 const workflowRun = json . workflow_runs . find ( run => run . head_sha === commit ) ;
5755
5856 if ( workflowRun == null || workflowRun . id == null ) {
5957 console . log (
60- theme `{error The workflow run for the specified commit (${ commit } ) could not be found. }`
58+ theme `{error The workflow run for the specified commit (${ commit } ) could not be found in ${ url } }`
6159 ) ;
6260 process . exit ( 1 ) ;
6361 }
@@ -67,7 +65,7 @@ async function getWorkflowRun(commit) {
6765
6866async function getArtifact ( workflowRunId , artifactName ) {
6967 const res = await exec (
70- `curl -L ${ GITHUB_HEADERS } https://api.github.com/repos/${ OWNER } / ${ REPO } /actions/runs/${ workflowRunId } /artifacts?per_page=100&name=${ artifactName } `
68+ `curl -L ${ GITHUB_HEADERS } https://api.github.com/repos/${ repository } /actions/runs/${ workflowRunId } /artifacts?per_page=100&name=${ artifactName } `
7169 ) ;
7270
7371 const json = JSON . parse ( res . stdout ) ;
@@ -77,7 +75,7 @@ async function getArtifact(workflowRunId, artifactName) {
7775
7876 if ( artifact == null ) {
7977 console . log (
80- theme `{error The specified workflow run (${ workflowRunId } ) does not contain any build artifacts .}`
78+ theme `{error The specified workflow run (${ workflowRunId } ) does not contain any artifact named ${ artifactName } .}`
8179 ) ;
8280 process . exit ( 1 ) ;
8381 }
@@ -103,7 +101,7 @@ async function processArtifact(artifact, opts) {
103101 // Use https://cli.github.com/manual/gh_attestation_verify to verify artifact
104102 if ( executableIsAvailable ( 'gh' ) ) {
105103 await exec (
106- `gh attestation verify artifacts_combined.zip --repo=${ OWNER } / ${ REPO } ` ,
104+ `gh attestation verify artifacts_combined.zip --repo=${ repository } ` ,
107105 {
108106 cwd : tmpDir ,
109107 }
@@ -175,20 +173,12 @@ async function downloadArtifactsFromGitHub(opts) {
175173 break ;
176174 }
177175 case 'completed' : {
178- if ( workflowRun . conclusion === 'success' ) {
179- const artifact = await getArtifact (
180- workflowRun . id ,
181- 'artifacts_combined'
182- ) ;
183- await processArtifact ( artifact , opts ) ;
184- return ;
185- } else {
186- console . log (
187- theme `{error Could not download build as its conclusion was: ${ workflowRun . conclusion } }`
188- ) ;
189- process . exit ( 1 ) ;
190- }
191- break ;
176+ const artifact = await getArtifact (
177+ workflowRun . id ,
178+ 'artifacts_combined'
179+ ) ;
180+ await processArtifact ( artifact , opts ) ;
181+ return ;
192182 }
193183 default : {
194184 console . log (
0 commit comments