ci(gitflow): enforce branch and PR governance checks
This commit is contained in:
25
.gitea/scripts/check-branch-name.sh
Executable file
25
.gitea/scripts/check-branch-name.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env sh
|
||||
set -eu
|
||||
|
||||
branch="${1:-}"
|
||||
|
||||
if [ -z "$branch" ]; then
|
||||
echo "Missing branch name."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$branch" in
|
||||
dev|staging|main)
|
||||
echo "Long-lived branch detected: $branch"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
if printf "%s" "$branch" | grep -Eq '^(todo|refactor|code)\/[a-z0-9]+([._-][a-z0-9]+)*$'; then
|
||||
echo "Branch naming valid: $branch"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Invalid branch name: $branch"
|
||||
echo "Expected: todo/<slug> | refactor/<slug> | code/<slug>"
|
||||
exit 1
|
||||
Reference in New Issue
Block a user