Skip to content

Commit

Permalink
Create pre-commit (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
guibranco authored Mar 7, 2024
1 parent 09b3ad4 commit e41d9df
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
LC_ALL=C

local_branch="$(git rev-parse --abbrev-ref HEAD)"

valid_branch_regex="^(dependabot|feature|fix|docs|style|refactor|perf|hotfix|test|chore|create)(\/[a-zA-Z0-9._-]+)+$"

message="There is something wrong with your branch name. Branch names in this project must adhere to this contract: $valid_branch_regex. Your commit will be rejected. You should rename your branch to a valid name and try again."

if [[ ! $local_branch =~ $valid_branch_regex ]]
then
echo "$message"
exit 1
fi

0 comments on commit e41d9df

Please sign in to comment.