From 0ca6e410595aaaa3cfc299e8bcf330ef0e31d5fe Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Mon, 30 May 2022 17:27:20 +0100 Subject: [PATCH] Check isOnAReleaseTag alongside isOnAReleaseBranch --- scripts/hermes/hermes-utils.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/scripts/hermes/hermes-utils.js b/scripts/hermes/hermes-utils.js index 2bd84452749..0c55f338751 100644 --- a/scripts/hermes/hermes-utils.js +++ b/scripts/hermes/hermes-utils.js @@ -171,9 +171,27 @@ function isOnAReleaseBranch() { ); } +function isOnAReleaseTag() { + try { + // If on a named tag, this method will return the tag name. + // If not, it will throw as the return code is not 0. + execSync('git describe --exact-match HEAD', {stdio: 'ignore'}); + } catch (error) { + return false; + } + let currentRemote = execSync('git config --get remote.origin.url') + .toString() + .trim(); + return currentRemote.endsWith('facebook/react-native.git'); +} + function shouldBuildHermesFromSource() { const hermesTag = readHermesTag(); - return isOnAReleaseBranch() || hermesTag === DEFAULT_HERMES_TAG; + return ( + isOnAReleaseBranch() || + isOnAReleaseTag() || + hermesTag === DEFAULT_HERMES_TAG + ); } function shouldUsePrebuiltHermesC(os) {