Skip to content

Commit

Permalink
Improve branch name compliance to allow underscores (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
ccaulonque authored Dec 13, 2023
1 parent 941be0d commit c34602b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/branch.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
exports.isBranchNameValid = (branchName) =>
(!!branchName.match(
/^(core|feature|fix|hotfix|asset|rework|documentation|mobsuccessbot|dependabot)\/([a-z][a-z0-9.-]*)$/
/^(core|feature|fix|hotfix|asset|rework|documentation|mobsuccessbot|dependabot)\/([a-z][a-z0-9._-]*)$/
) ||
!!branchName.match(/^(mobsuccessbot)\/([a-z0-9_\-@./_-]*)$/) ||
!!branchName.match(/^(dependabot)\/([a-z][a-zA-Z0-9./_-]*)$/) ||
Expand Down
1 change: 1 addition & 0 deletions lib/branch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ describe("branch", () => {
expect(isBranchNameValid("foo/foo-bar")).toBe(false);
expect(isBranchNameValid("core/foo--bar")).toBe(true);
expect(isBranchNameValid("core/foo--bar--z")).toBe(true);
expect(isBranchNameValid("feature/branch-name_from_linear")).toBe(true);
});
test("recognize invalid branch names", () => {
expect(isBranchNameValid("core/npm_and_yarn/axios-0.21.1")).toBe(false);
Expand Down

0 comments on commit c34602b

Please sign in to comment.