File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed
packages/branch-utilities/src/lib Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -95,9 +95,13 @@ describe('base utils', () => {
9595
9696 test ( 'works for github copilot created branches' , ( ) => {
9797 expect ( parseBranchName ( 'copilot/fix-123' ) ) . toEqual ( { branchId : 123 , branchName : 'fix' } satisfies ReturnType < typeof parseBranchName > )
98+ expect ( parseBranchName ( 'copilot/feat-123' ) ) . toEqual ( { branchId : 123 , branchName : 'feat' } satisfies ReturnType < typeof parseBranchName > )
9899 } )
100+
99101 test ( 'throws when invalid pattern' , ( ) => {
100102 expect ( ( ) => parseBranchName ( 'whrjwe' ) ) . toThrow ( )
103+ expect ( ( ) => parseBranchName ( 'copilot/123-fix' ) ) . toThrow ( )
104+ expect ( ( ) => parseBranchName ( 'feat/copilot/fix-123' ) ) . toThrow ( )
101105 } )
102106 } )
103107} )
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ const REGEX_BRANCH_NAME_DEFAULT = /^[a-z]*\/?#(?<id>\d+)-(?<name>.*)$/
1818 * regex to match the branch convention github copilot uses with the following named capture groups: id, name
1919 * @example copilot/fix-789 -> { id: '789', name: 'fix' }
2020 */
21- const REGEX_BRANCH_NAME_COPILOT = / c o p i l o t \/ (?< name > f i x ) - (?< id > \d + ) /
21+ const REGEX_BRANCH_NAME_COPILOT = / ^ c o p i l o t \/ (?< name > . * ) - (?< id > \d + ) $ /
2222
2323export interface StageInfo {
2424 isProd : boolean
You can’t perform that action at this time.
0 commit comments