diff --git a/.github/workflows/commit_artifacts.yml b/.github/workflows/commit_artifacts.yml index 8c016b276ff05..9a4516342221e 100644 --- a/.github/workflows/commit_artifacts.yml +++ b/.github/workflows/commit_artifacts.yml @@ -2,7 +2,7 @@ name: Commit Artifacts for Meta WWW and fbsource on: push: - branches: [main, meta-www, meta-fbsource] + branches: [main, meta-www, meta-fbsource, rh/test-ci-new] jobs: download_artifacts: @@ -72,53 +72,55 @@ jobs: }); } - let artifactsUrl = null; - // This is a temporary, dirty hack to avoid needing a GitHub auth token in the circleci - // workflow to notify this GitHub action. Sorry! - let iter = 0; - spinloop: while (iter < 15) { - const res = await github.rest.repos.listCommitStatusesForRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: context.sha - }); - for (const status of res.data) { - if (/process_artifacts_combined/.test(status.context)) { - switch (status.state) { - case 'pending': { - console.log(`${status.context} is still pending`); - break; - } - case 'failure': - case 'error': { - throw new Error(`${status.context} has failed or errored`); - } - case 'success': { - // The status does not include a build ID, but we can extract it - // from the URL. I couldn't find a better way to do this. - const ciBuildId = /\/facebook\/react\/([0-9]+)/.exec( - status.target_url, - )[1]; - if (Number.parseInt(ciBuildId, 10) + '' === ciBuildId) { - artifactsUrl = - `https://circleci.com/api/v1.1/project/github/facebook/react/${ciBuildId}/artifacts`; - console.log(`Found artifactsUrl: ${artifactsUrl}`); - break spinloop; - } else { - throw new Error(`${ciBuildId} isn't a number`); + let artifactsUrl = `https://circleci.com/api/v1.1/project/github/facebook/react/905149/artifacts`; + if (!artifactsUrl) { + // This is a temporary, dirty hack to avoid needing a GitHub auth token in the circleci + // workflow to notify this GitHub action. Sorry! + let iter = 0; + spinloop: while (iter < 15) { + const res = await github.rest.repos.listCommitStatusesForRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: context.sha + }); + for (const status of res.data) { + if (/process_artifacts_combined/.test(status.context)) { + switch (status.state) { + case 'pending': { + console.log(`${status.context} is still pending`); + break; + } + case 'failure': + case 'error': { + throw new Error(`${status.context} has failed or errored`); + } + case 'success': { + // The status does not include a build ID, but we can extract it + // from the URL. I couldn't find a better way to do this. + const ciBuildId = /\/facebook\/react\/([0-9]+)/.exec( + status.target_url, + )[1]; + if (Number.parseInt(ciBuildId, 10) + '' === ciBuildId) { + artifactsUrl = + `https://circleci.com/api/v1.1/project/github/facebook/react/${ciBuildId}/artifacts`; + console.log(`Found artifactsUrl: ${artifactsUrl}`); + break spinloop; + } else { + throw new Error(`${ciBuildId} isn't a number`); + } + break; + } + default: { + throw new Error(`Unhandled status state: ${status.state}`); + break; } - break; - } - default: { - throw new Error(`Unhandled status state: ${status.state}`); - break; } } } + iter++; + console.log("Sleeping for 60s..."); + await sleep(60_000); } - iter++; - console.log("Sleeping for 60s..."); - await sleep(60_000); } if (artifactsUrl != null) { const {CIRCLECI_TOKEN} = process.env; @@ -222,7 +224,7 @@ jobs: commit_www_artifacts: needs: download_artifacts - if: ${{ (github.ref == 'refs/heads/main' && needs.download_artifacts.outputs.www_branch_count == '0') || github.ref == 'refs/heads/meta-www' }} + if: ${{ (github.ref == 'refs/heads/main' && needs.download_artifacts.outputs.www_branch_count == '0') || github.ref == 'refs/heads/meta-www' || github.ref == 'refs/heads/rh/test-ci-new' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -305,7 +307,7 @@ jobs: commit_fbsource_artifacts: needs: download_artifacts - if: ${{ (github.ref == 'refs/heads/main' && needs.download_artifacts.outputs.fbsource_branch_count == '0') || github.ref == 'refs/heads/meta-fbsource' }} + if: ${{ (github.ref == 'refs/heads/main' && needs.download_artifacts.outputs.fbsource_branch_count == '0') || github.ref == 'refs/heads/meta-fbsource' || github.ref == 'refs/heads/rh/test-ci-new' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -389,7 +391,7 @@ jobs: } return data.replace(NEWTOKEN, `SignedSource<<${hash(data, 'utf8')}>>`); }, - }; + }; const directory = './compiled-rn'; console.log('Signing files in directory:', directory); @@ -499,7 +501,7 @@ jobs: } return data.replace(NEWTOKEN, `SignedSource<<${hash(data, 'utf8')}>>`); }, - }; + }; const directory = './compiled-rn'; console.log('Signing files in directory:', directory);