Skip to content

Commit

Permalink
update checkbranch sh
Browse files Browse the repository at this point in the history
  • Loading branch information
ty-esi committed Oct 28, 2024
1 parent 65a5a77 commit f4c9000
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .husky/scripts/check-branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ develop_branch="^develop$"
feature_branch="^feature\/[a-zA-Z0-9_-]+$"
bugfix_branch="^bugfix\/[a-zA-Z0-9_-]+$"
release_branch="^release\/[0-9]+(\.[0-9]+)*$"
release_build_branch="^[0-9]+\.[0-9]+\.[0-9]+\.build$"
hotfix_branch="^hotfix\/[a-zA-Z0-9_-]+$"

# Check if the branch name matches any of the valid patterns
if [[ $branch_name =~ $main_branch || $branch_name =~ $develop_branch || $branch_name =~ $feature_branch || $branch_name =~ $bugfix_branch || $branch_name =~ $release_branch || $branch_name =~ $hotfix_branch ]]; then
if [[ $branch_name =~ $main_branch || $branch_name =~ $develop_branch || $branch_name =~ $feature_branch || $branch_name =~ $bugfix_branch || $branch_name =~ $release_branch || $branch_name =~ $hotfix_branch || $branch_name =~ $release_build_branch]]; then
echo "✅ Branch name '$branch_name' is valid."
exit 0
else
Expand All @@ -26,6 +27,7 @@ else
echo "- bugfix/<issue-id>"
echo "- release/<version>"
echo "- hotfix/<issue-id>"
echo "- <version>.build"
echo "where <issue-id> can be alphanumeric (letters, numbers, hyphens, or underscores)."
echo "example feature/ICDC-2555"
exit 1
Expand Down

0 comments on commit f4c9000

Please sign in to comment.