Skip to content

Commit

Permalink
chore: add husky pre-commit for email validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Badisi committed Jul 11, 2024
1 parent 0a0c616 commit 0584563
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
printf "> Validating user email... "

gitUserEmail="$(git config user.email)"
if [[ $gitUserEmail =~ ^.*@(hcuge|hug).ch$ ]] ; then
printf "\n"
printf "For privacy, git user email should not end with @hcuge.ch or @hug.ch\n"
printf "Received: %s\n" $gitUserEmail
printf "\n"
printf "You can fix this with the following command:\n"
printf "git config --global user.email <your_email>\n"
exit 1
else
printf "OK\n"
fi

0 comments on commit 0584563

Please sign in to comment.