-
Notifications
You must be signed in to change notification settings - Fork 46.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
--commit
param to release scripts (#20703)
Alternative to `--build`. Uses same logic as sizebot and www sync script. Immediate motivation is I want sizebot to use the `download-experimental-build` command in CI. Will do that next.
- Loading branch information
Showing
4 changed files
with
66 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
'use strict'; | ||
|
||
const fetch = require('node-fetch'); | ||
|
||
async function getBuildIdForCommit(sha) { | ||
let ciBuildId = null; | ||
const statusesResponse = await fetch( | ||
`https://api.github.com/repos/facebook/react/commits/${sha}/status` | ||
); | ||
|
||
if (!statusesResponse.ok) { | ||
throw Error('Could not find commit for: ' + sha); | ||
} | ||
|
||
const {statuses, state} = await statusesResponse.json(); | ||
if (state === 'failure') { | ||
throw new Error(`Base commit is broken: ${sha}`); | ||
} | ||
for (let i = 0; i < statuses.length; i++) { | ||
const status = statuses[i]; | ||
if (status.context === `ci/circleci: process_artifacts_combined`) { | ||
if (status.state === 'success') { | ||
ciBuildId = /\/facebook\/react\/([0-9]+)/.exec(status.target_url)[1]; | ||
break; | ||
} | ||
if (status.state === 'pending') { | ||
throw new Error(`Build job for base commit is still pending: ${sha}`); | ||
} | ||
} | ||
} | ||
return ciBuildId; | ||
} | ||
|
||
module.exports = getBuildIdForCommit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters