chore: fix branch naming regex pattern

The previous pre-commit script allowed only branch names with three words. Should allow one to 6 words.

ref: N25B-89
This commit is contained in:
Twirre Meulenbelt
2025-10-08 13:07:47 +02:00
parent f889fad732
commit c515f32023

View File

@@ -8,11 +8,11 @@ if echo "$branch" | grep -Eq "(dev|main)"; then
fi fi
# allowed pattern <type/> # allowed pattern <type/>
if echo "$branch" | grep -Eq "^(feat|fix|refactor|perf|style|test|docs|build|chore|revert)\/\w+-\w+-\w+"; then if echo "$branch" | grep -Eq "^(feat|fix|refactor|perf|style|test|docs|build|chore|revert)\/\w+(-\w+){0,5}$"; then
echo "✅ Branch name valid: $branch" echo "✅ Branch name valid: $branch"
exit 0 exit 0
else else
echo "❌ Invalid branch name: $branch" echo "❌ Invalid branch name: $branch"
echo "Branch must be named <type>/<description-of-branch> (must have 2 stipes - -)" echo "Branch must be named <type>/<description-of-branch> (must have one to six words separated by a dash)"
exit 1 exit 1
fi fi