Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions lib/branch.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
function isBranchNameValid(branchName) {
return (
!!branchName.match(
/^(hotfix|feat|fix|chore|docs|refactor|test|revert|ci|perf|style|build|change|remove|poc|mobsuccessbot|dependabot)\/([a-z][a-z0-9._-]*)$/
/^(hotfix|feat|fix|chore|docs|refactor|test|revert|ci|perf|style|build|change|remove|poc|mobsuccessbot|dependabot)\/([a-z][a-z0-9._-]*)$/.test(
branchName
) ||
!!branchName.match(/^revert-([0-9]+)-([a-z0-9_\-@./_-]*)$/) ||
!!branchName.match(/^(mobsuccessbot)\/([a-z0-9_\-@./_-]*)$/) ||
!!branchName.match(/^(dependabot)\/([a-z][a-zA-Z0-9./_-]*)$/) ||
!!branchName.match(/^(renovate)\/([a-z0-9_\-@./_-]*)$/) ||
!!branchName.match(/^(copilot)\/([a-z0-9_\-@./_-]*)$/)
/^revert-([0-9]+)-([a-z0-9_\-@./_-]*)$/.test(branchName) ||
/^(mobsuccessbot)\/([a-z0-9_\-@./_-]*)$/.test(branchName) ||
Comment thread
maastrich marked this conversation as resolved.
/^(dependabot)\/([a-z][a-zA-Z0-9./_-]*)$/.test(branchName) ||
Comment thread
maastrich marked this conversation as resolved.
/^(renovate)\/([a-z0-9_\-@./_-]*)$/.test(branchName) ||
/^(copilot)\/([a-z0-9_\-@./_-]*)$/.test(branchName) ||
/^crowdin\/update-translations$/.test(branchName)
);
}

Expand Down
2 changes: 2 additions & 0 deletions lib/branch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ describe("branch", () => {
"renovate/configure",
"renovate/tanstack-table-monorepo",
"renovate/mobsuccess-devops-dlpo-react-client-1.x",
"crowdin/update-translations",
])("Test branch %s should be valid", (branch) => {
expect(isBranchNameValid(branch)).toBe(true);
});
Expand All @@ -42,6 +43,7 @@ describe("branch", () => {
"rework/fooDriveFooterBar",
"chore//foo",
"revert-change/brevo-emailing",
"crowdin/not-update-translations",
])("Test branch %s should be invalid", (branch) => {
expect(isBranchNameValid(branch)).toBe(false);
});
Expand Down
Loading