Skip to content

Commit

Permalink
chore(hooks): make pre-commit message look prettier πŸ’… (#1121)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbazhlekova authored Mar 25, 2024
1 parent d30783d commit 2ce6698
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions .githooks/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/usr/bin/env bash
#!/bin/sh

RED="\033[0;31m"
END_COLOR="\033[0m"

commit_types="(chore|docs|feat|fix|refactor|tests?)"
conventional_commit_regex="^${commit_types}(\([a-z \-]+\))?!?: .+$"
Expand All @@ -9,11 +12,15 @@ if [[ "$commit_message" =~ $conventional_commit_regex ]]; then
echo -e "Commit message meets Conventional Commit standards..."
exit 0
fi
echo
echo "${RED}Commit lint failed. Please update your commit message format. ${END_COLOR}"
echo "Example commit messages:"
echo " feat(scope): add your feature description here"
echo " fix(scope): add your fix description here"
echo " chore(scope): add your chore description here"
echo " docs(scope): add your docs description here"
echo " refactor(scope): add your refactor description here"
echo " tests(scope): add your tests description here"
echo


echo -e "The commit message does not meet the Conventional Commit standard"
echo "An example of a valid message is: "
echo " feat(login): add the 'remember me' button"
echo "More details at: https://www.conventionalcommits.org/en/v1.0.0/#summary"

exit 1
exit 1

0 comments on commit 2ce6698

Please sign in to comment.