From fadd7e056d347f034dd3117b127b6d5ec46d9455 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Wed, 23 Oct 2019 12:51:44 -0700 Subject: [PATCH] build: handle -x-y format for getCurrentBranch (#20706) --- script/lib/utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/lib/utils.js b/script/lib/utils.js index 56a4c8b26886..e6f8b49c2de0 100644 --- a/script/lib/utils.js +++ b/script/lib/utils.js @@ -54,7 +54,7 @@ async function handleGitCall (args, gitDir) { async function getCurrentBranch (gitDir) { let branch = await handleGitCall(['rev-parse', '--abbrev-ref', 'HEAD'], gitDir) - if (branch !== 'master' && !branch.match(/[0-9]+-[0-9]+-x/)) { + if (branch !== 'master' && !branch.match(/[0-9]+-[0-9]+-x$/) && !branch.match(/[0-9]+-x-y$/)) { const lastCommit = await handleGitCall(['rev-parse', 'HEAD'], gitDir) const branches = (await handleGitCall([ 'branch', @@ -63,7 +63,7 @@ async function getCurrentBranch (gitDir) { '--remote' ], gitDir)).split('\n') - branch = branches.filter(b => b.trim() === 'master' || b.match(/[0-9]+-[0-9]+-x/))[0] + branch = branches.filter(b => b.trim() === 'master' || b.trim().match(/^[0-9]+-[0-9]+-x$/) || b.trim().match(/^[0-9]+-x-y$/))[0] if (!branch) { console.log(`${fail} no release branch exists for this ref`) process.exit(1)