From c34602ba8b717a621951fd42869b23b6cca7f2f2 Mon Sep 17 00:00:00 2001 From: Cyril <32077749+ccaulonque@users.noreply.github.com> Date: Wed, 13 Dec 2023 17:09:06 +0100 Subject: [PATCH] Improve branch name compliance to allow underscores (#75) --- lib/branch.js | 2 +- lib/branch.test.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/branch.js b/lib/branch.js index 948ea7382..8ac17ddc9 100644 --- a/lib/branch.js +++ b/lib/branch.js @@ -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./_-]*)$/) || diff --git a/lib/branch.test.js b/lib/branch.test.js index fcba3be18..721562951 100644 --- a/lib/branch.test.js +++ b/lib/branch.test.js @@ -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);