From 59f778890e3234e334771882a4c2a83beb6af2cb Mon Sep 17 00:00:00 2001 From: Pascal Arevalo Date: Wed, 4 Jan 2023 14:12:48 -0500 Subject: [PATCH] fix(cherry-pick-bot): allow forward slash in branch name (#4854) --- packages/cherry-pick-bot/src/cherry-pick.ts | 2 +- packages/cherry-pick-bot/test/cherry-pick.ts | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/cherry-pick-bot/src/cherry-pick.ts b/packages/cherry-pick-bot/src/cherry-pick.ts index 4bd8afb682b..3f6a64d0c67 100644 --- a/packages/cherry-pick-bot/src/cherry-pick.ts +++ b/packages/cherry-pick-bot/src/cherry-pick.ts @@ -33,7 +33,7 @@ interface Commit { sha: string; } -const COMMENT_REGEX = /^\/cherry-pick\s+(?\w[.-\w]*)/; +const COMMENT_REGEX = /^\/cherry-pick\s+(?\w[./-\w]*)/; /** * Parse a comment string to see if it matches the expected cherry-pick diff --git a/packages/cherry-pick-bot/test/cherry-pick.ts b/packages/cherry-pick-bot/test/cherry-pick.ts index 1325cf432ca..7b18d38ec68 100644 --- a/packages/cherry-pick-bot/test/cherry-pick.ts +++ b/packages/cherry-pick-bot/test/cherry-pick.ts @@ -45,6 +45,11 @@ describe('parseCherryPickComment', () => { const branch = parseCherryPickComment('\n/cherry-pick 2.1.x '); assert.strictEqual(branch, '2.1.x'); }); + + it('handles forward slash format', () => { + const branch = parseCherryPickComment('\n/cherry-pick release/2.1.x '); + assert.strictEqual(branch, 'release/2.1.x'); + }); }); describe('cherryPickCommits', () => {