Skip to content

Commit ee6733e

Browse files
authored
feat(branch-name): allow crowdin branch name [EXP-2523] (#135)
1 parent 27c78de commit ee6733e

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

lib/branch.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
function isBranchNameValid(branchName) {
22
return (
3-
!!branchName.match(
4-
/^(hotfix|feat|fix|chore|docs|refactor|test|revert|ci|perf|style|build|change|remove|poc|mobsuccessbot|dependabot)\/([a-z][a-z0-9._-]*)$/
3+
/^(hotfix|feat|fix|chore|docs|refactor|test|revert|ci|perf|style|build|change|remove|poc|mobsuccessbot|dependabot)\/([a-z][a-z0-9._-]*)$/.test(
4+
branchName
55
) ||
6-
!!branchName.match(/^revert-([0-9]+)-([a-z0-9_\-@./_-]*)$/) ||
7-
!!branchName.match(/^(mobsuccessbot)\/([a-z0-9_\-@./_-]*)$/) ||
8-
!!branchName.match(/^(dependabot)\/([a-z][a-zA-Z0-9./_-]*)$/) ||
9-
!!branchName.match(/^(renovate)\/([a-z0-9_\-@./_-]*)$/) ||
10-
!!branchName.match(/^(copilot)\/([a-z0-9_\-@./_-]*)$/)
6+
/^revert-([0-9]+)-([a-z0-9_\-@./_-]*)$/.test(branchName) ||
7+
/^(mobsuccessbot)\/([a-z0-9_\-@./_-]*)$/.test(branchName) ||
8+
/^(dependabot)\/([a-z][a-zA-Z0-9./_-]*)$/.test(branchName) ||
9+
/^(renovate)\/([a-z0-9_\-@./_-]*)$/.test(branchName) ||
10+
/^(copilot)\/([a-z0-9_\-@./_-]*)$/.test(branchName) ||
11+
/^crowdin\/update-translations$/.test(branchName)
1112
);
1213
}
1314

lib/branch.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ describe("branch", () => {
2020
"renovate/configure",
2121
"renovate/tanstack-table-monorepo",
2222
"renovate/mobsuccess-devops-dlpo-react-client-1.x",
23+
"crowdin/update-translations",
2324
])("Test branch %s should be valid", (branch) => {
2425
expect(isBranchNameValid(branch)).toBe(true);
2526
});
@@ -42,6 +43,7 @@ describe("branch", () => {
4243
"rework/fooDriveFooterBar",
4344
"chore//foo",
4445
"revert-change/brevo-emailing",
46+
"crowdin/not-update-translations",
4547
])("Test branch %s should be invalid", (branch) => {
4648
expect(isBranchNameValid(branch)).toBe(false);
4749
});

0 commit comments

Comments
 (0)