[build] Fix CI failure when master and release branch are identical
The search for branches containing the previous hash could return multiple matches on different lines, if, for instance, a newly-cut release branch were identical to master.
This commit is contained in:
@@ -24,7 +24,7 @@ if (pr) {
|
||||
} else {
|
||||
const head = process.env['CIRCLE_SHA1'];
|
||||
for (const sha of execSync(`git rev-list --max-count=10 ${head}`).toString().trim().split('\n')) {
|
||||
const base = execSync(`git branch -r --contains ${sha} origin/master origin/release-*`).toString().trim().replace(/^origin\//, '');
|
||||
const base = execSync(`git branch -r --contains ${sha} origin/master origin/release-*`).toString().replace(/$\n.*/m, '').trim().replace(/^origin\//, '');
|
||||
if (base) {
|
||||
const mergeBase = execSync(`git merge-base origin/${base} ${head}`).toString().trim();
|
||||
console.log(`export CIRCLE_TARGET_BRANCH=${base}`);
|
||||
|
||||
Reference in New Issue
Block a user