Lazily query for git branch & remote (#33936)

This commit is contained in:
Nicola Corti
2022-05-31 13:22:16 +01:00
committed by GitHub
parent 88fa872896
commit f50936bef2
2 changed files with 21 additions and 13 deletions
+15 -10
View File
@@ -159,16 +159,21 @@ function copyPodSpec() {
}
function isOnAReleaseBranch() {
let currentBranch = execSync('git rev-parse --abbrev-ref HEAD')
.toString()
.trim();
let currentRemote = execSync('git config --get remote.origin.url')
.toString()
.trim();
return (
currentBranch.endsWith('-stable') &&
currentRemote.endsWith('facebook/react-native.git')
);
try {
let currentBranch = execSync('git rev-parse --abbrev-ref HEAD')
.toString()
.trim();
let currentRemote = execSync('git config --get remote.origin.url')
.toString()
.trim();
return (
currentBranch.endsWith('-stable') &&
currentRemote.endsWith('facebook/react-native.git')
);
} catch (error) {
// If not inside a git repo, we're going to fail here and return.
return false;
}
}
function isOnAReleaseTag() {