Skip to content

Commit a0e99f7

Browse files
committed
Revert bad push
1 parent 13cd401 commit a0e99f7

File tree

1 file changed

+49
-51
lines changed

1 file changed

+49
-51
lines changed

.github/workflows/commit_artifacts.yml

Lines changed: 49 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Commit Artifacts for Meta WWW and fbsource
22

33
on:
44
push:
5-
branches: [main, meta-www, meta-fbsource, rh/test-ci-new]
5+
branches: [main, meta-www, meta-fbsource]
66

77
jobs:
88
download_artifacts:
@@ -72,55 +72,53 @@ jobs:
7272
});
7373
}
7474
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`);
116109
}
110+
break;
111+
}
112+
default: {
113+
throw new Error(`Unhandled status state: ${status.state}`);
114+
break;
117115
}
118116
}
119117
}
120-
iter++;
121-
console.log("Sleeping for 60s...");
122-
await sleep(60_000);
123118
}
119+
iter++;
120+
console.log("Sleeping for 60s...");
121+
await sleep(60_000);
124122
}
125123
if (artifactsUrl != null) {
126124
const {CIRCLECI_TOKEN} = process.env;
@@ -224,7 +222,7 @@ jobs:
224222

225223
commit_www_artifacts:
226224
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' }}
228226
runs-on: ubuntu-latest
229227
steps:
230228
- uses: actions/checkout@v4
@@ -293,7 +291,7 @@ jobs:
293291
echo ":"
294292
git status -u
295293
- 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'
297295
uses: stefanzweifel/git-auto-commit-action@v4
298296
with:
299297
commit_message: |
@@ -307,7 +305,7 @@ jobs:
307305

308306
commit_fbsource_artifacts:
309307
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' }}
311309
runs-on: ubuntu-latest
312310
steps:
313311
- uses: actions/checkout@v4
@@ -391,7 +389,7 @@ jobs:
391389
}
392390
return data.replace(NEWTOKEN, `SignedSource<<${hash(data, 'utf8')}>>`);
393391
},
394-
};
392+
};
395393
396394
const directory = './compiled-rn';
397395
console.log('Signing files in directory:', directory);
@@ -501,7 +499,7 @@ jobs:
501499
}
502500
return data.replace(NEWTOKEN, `SignedSource<<${hash(data, 'utf8')}>>`);
503501
},
504-
};
502+
};
505503
506504
const directory = './compiled-rn';
507505
console.log('Signing files in directory:', directory);
@@ -535,7 +533,7 @@ jobs:
535533
run: |
536534
git status -u
537535
- 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'
539537
uses: stefanzweifel/git-auto-commit-action@v4
540538
with:
541539
commit_message: |

0 commit comments

Comments
 (0)