Files
pepperplus-ui/.githooks/pre-commit
Twirre Meulenbelt c515f32023 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
2025-10-08 13:07:47 +02:00

18 lines
494 B
Bash
Executable File

#!/bin/sh
# Get current branch
branch=$(git rev-parse --abbrev-ref HEAD)
if echo "$branch" | grep -Eq "(dev|main)"; then
echo 0
fi
# allowed pattern <type/>
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"
exit 0
else
echo "❌ Invalid branch name: $branch"
echo "Branch must be named <type>/<description-of-branch> (must have one to six words separated by a dash)"
exit 1
fi