mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
fix: build hermes from source on PR against stable
This commit is contained in:
@@ -190,12 +190,27 @@ function isOnAReleaseTag() {
|
||||
return currentRemote.endsWith('facebook/react-native.git');
|
||||
}
|
||||
|
||||
function shouldBuildHermesFromSource() {
|
||||
function isPRAgainstStable(pullRequest) {
|
||||
if (pullRequest == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const prComponents = pullRequest.split('/');
|
||||
const prNumber = prComponents[prComponents.length - 1];
|
||||
const apiURL = `https://api.github.com/repos/facebook/react-native/pulls/${prNumber}`;
|
||||
const prJson = JSON.parse(execSync(`curl ${apiURL}`).toString());
|
||||
const baseBranch = prJson.base.label;
|
||||
|
||||
return baseBranch.endsWith('-stable');
|
||||
}
|
||||
|
||||
function shouldBuildHermesFromSource(pullRequest) {
|
||||
const hermesTag = readHermesTag();
|
||||
|
||||
return (
|
||||
isOnAReleaseBranch() ||
|
||||
isOnAReleaseTag() ||
|
||||
isPRAgainstStable(pullRequest) ||
|
||||
hermesTag === DEFAULT_HERMES_TAG
|
||||
);
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ const {
|
||||
shouldBuildHermesFromSource,
|
||||
} = require('./hermes-utils');
|
||||
|
||||
async function main() {
|
||||
if (!shouldBuildHermesFromSource()) {
|
||||
async function main(pullRequest) {
|
||||
if (!shouldBuildHermesFromSource(pullRequest)) {
|
||||
copyPodSpec();
|
||||
return;
|
||||
}
|
||||
@@ -40,6 +40,8 @@ async function main() {
|
||||
}
|
||||
}
|
||||
|
||||
main().then(() => {
|
||||
const pullRequest = process.argv.length > 2 ? process.argv[2] : null;
|
||||
console.log(`Pull request detected: ${pullRequest}`);
|
||||
main(pullRequest).then(() => {
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user