mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
Remove sizebot race condition (#15735)
Sometimes the status of the `build` job is not in the first page of the `/statuses` endpoint. The combined `/status` endpoint consolidates the entries, though, so it always appears there.
This commit is contained in:
@@ -126,9 +126,13 @@ function git(args) {
|
||||
try {
|
||||
let baseCIBuildId = null;
|
||||
const statusesResponse = await fetch(
|
||||
`https://api.github.com/repos/facebook/react/commits/${baseCommit}/statuses`
|
||||
`https://api.github.com/repos/facebook/react/commits/${baseCommit}/status`
|
||||
);
|
||||
const statuses = await statusesResponse.json();
|
||||
const {statuses, state} = await statusesResponse.json();
|
||||
if (state === 'failure') {
|
||||
warn(`Base commit is broken: ${baseCommit}`);
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < statuses.length; i++) {
|
||||
const status = statuses[i];
|
||||
// This must match the name of the CI job that creates the build artifacts
|
||||
@@ -139,8 +143,8 @@ function git(args) {
|
||||
)[1];
|
||||
break;
|
||||
}
|
||||
if (status.state === 'failure') {
|
||||
warn(`Base commit is broken: ${baseCommit}`);
|
||||
if (status.state === 'pending') {
|
||||
warn(`Build job for base commit is still pending: ${baseCommit}`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user