@samitouri / QOS-React / commits / a0e99f7a6d

Revert bad push

Rick Hanlon committed Jun 10, 2024 at 10:51 UTC a0e99f7a6dbc135f94396bdea3d91c4b40135059
1 file changed +49 -51
.github/workflows/commit_artifacts.yml
+49 -51
@@ -2,7 +2,7 @@ name: Commit Artifacts for Meta WWW and fbsource
2
3 on:
4 push:
5 - branches: [main, meta-www, meta-fbsource, rh/test-ci-new]
5 + branches: [main, meta-www, meta-fbsource]
6
7 jobs:
8 download_artifacts:
@@ -72,55 +72,53 @@ jobs:
72 });
73 }
74
75 - let artifactsUrl = `https://circleci.com/api/v1.1/project/github/facebook/react/905149/artifacts`;
76 - if (!artifactsUrl) {
77 - // This is a temporary, dirty hack to avoid needing a GitHub auth token in the circleci
78 - // workflow to notify this GitHub action. Sorry!
79 - let iter = 0;
80 - spinloop: while (iter < 15) {
81 - const res = await github.rest.repos.listCommitStatusesForRef({
82 - owner: context.repo.owner,
83 - repo: context.repo.repo,
84 - ref: context.sha
85 - });
86 - for (const status of res.data) {
87 - if (/process_artifacts_combined/.test(status.context)) {
88 - switch (status.state) {
89 - case 'pending': {
90 - console.log(`${status.context} is still pending`);
91 - break;
92 - }
93 - case 'failure':
94 - case 'error': {
95 - throw new Error(`${status.context} has failed or errored`);
96 - }
97 - case 'success': {
98 - // The status does not include a build ID, but we can extract it
99 - // from the URL. I couldn't find a better way to do this.
100 - const ciBuildId = /\/facebook\/react\/([0-9]+)/.exec(
101 - status.target_url,
102 - )[1];
103 - if (Number.parseInt(ciBuildId, 10) + '' === ciBuildId) {
104 - artifactsUrl =
105 - `https://circleci.com/api/v1.1/project/github/facebook/react/${ciBuildId}/artifacts`;
106 - console.log(`Found artifactsUrl: ${artifactsUrl}`);
107 - break spinloop;
108 - } else {
109 - throw new Error(`${ciBuildId} isn't a number`);
110 - }
111 - break;
112 - }
113 - default: {
114 - throw new Error(`Unhandled status state: ${status.state}`);
115 - break;
75 + let artifactsUrl = null;
76 + // This is a temporary, dirty hack to avoid needing a GitHub auth token in the circleci
77 + // workflow to notify this GitHub action. Sorry!
78 + let iter = 0;
79 + spinloop: while (iter < 15) {
80 + const res = await github.rest.repos.listCommitStatusesForRef({
81 + owner: context.repo.owner,
82 + repo: context.repo.repo,
83 + ref: context.sha
84 + });
85 + for (const status of res.data) {
86 + if (/process_artifacts_combined/.test(status.context)) {
87 + switch (status.state) {
88 + case 'pending': {
89 + console.log(`${status.context} is still pending`);
90 + break;
91 + }
92 + case 'failure':
93 + case 'error': {
94 + throw new Error(`${status.context} has failed or errored`);
95 + }
96 + case 'success': {
97 + // The status does not include a build ID, but we can extract it
98 + // from the URL. I couldn't find a better way to do this.
99 + const ciBuildId = /\/facebook\/react\/([0-9]+)/.exec(
100 + status.target_url,
101 + )[1];
102 + if (Number.parseInt(ciBuildId, 10) + '' === ciBuildId) {
103 + artifactsUrl =
104 + `https://circleci.com/api/v1.1/project/github/facebook/react/${ciBuildId}/artifacts`;
105 + console.log(`Found artifactsUrl: ${artifactsUrl}`);
106 + break spinloop;
107 + } else {
108 + throw new Error(`${ciBuildId} isn't a number`);
109 }
110 + break;
111 + }
112 + default: {
113 + throw new Error(`Unhandled status state: ${status.state}`);
114 + break;
115 }
116 }
117 }
120 - iter++;
121 - console.log("Sleeping for 60s...");
122 - await sleep(60_000);
118 }
119 + iter++;
120 + console.log("Sleeping for 60s...");
121 + await sleep(60_000);
122 }
123 if (artifactsUrl != null) {
124 const {CIRCLECI_TOKEN} = process.env;
@@ -224,7 +222,7 @@ jobs:
222
223 commit_www_artifacts:
224 needs: download_artifacts
227 - 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' }}
225 + if: ${{ (github.ref == 'refs/heads/main' && needs.download_artifacts.outputs.www_branch_count == '0') || github.ref == 'refs/heads/meta-www' }}
226 runs-on: ubuntu-latest
227 steps:
228 - uses: actions/checkout@v4
@@ -293,7 +291,7 @@ jobs:
291 echo ":"
292 git status -u
293 - name: Commit changes to branch
296 - if: false && steps.check_should_commit.outputs.should_commit == 'true'
294 + if: steps.check_should_commit.outputs.should_commit == 'true'
295 uses: stefanzweifel/git-auto-commit-action@v4
296 with:
297 commit_message: |
@@ -307,7 +305,7 @@ jobs:
305
306 commit_fbsource_artifacts:
307 needs: download_artifacts
310 - 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' }}
308 + if: ${{ (github.ref == 'refs/heads/main' && needs.download_artifacts.outputs.fbsource_branch_count == '0') || github.ref == 'refs/heads/meta-fbsource' }}
309 runs-on: ubuntu-latest
310 steps:
311 - uses: actions/checkout@v4
@@ -391,7 +389,7 @@ jobs:
389 }
390 return data.replace(NEWTOKEN, `SignedSource<<${hash(data, 'utf8')}>>`);
391 },
394 - };
392 + };
393
394 const directory = './compiled-rn';
395 console.log('Signing files in directory:', directory);
@@ -501,7 +499,7 @@ jobs:
499 }
500 return data.replace(NEWTOKEN, `SignedSource<<${hash(data, 'utf8')}>>`);
501 },
504 - };
502 + };
503
504 const directory = './compiled-rn';
505 console.log('Signing files in directory:', directory);
@@ -535,7 +533,7 @@ jobs:
533 run: |
534 git status -u
535 - name: Commit changes to branch
538 - if: false && steps.check_should_commit.outputs.should_commit == 'true'
536 + if: steps.check_should_commit.outputs.should_commit == 'true'
537 uses: stefanzweifel/git-auto-commit-action@v4
538 with:
539 commit_message: |