File tree Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Original file line number Diff line number Diff line change 1- #! /usr/bin/env sh
1+ #! /bin/bash
2+
3+ # #
4+ # Git hook that enforces conventional commits
5+ # https://www.conventionalcommits.org
6+ # #
7+
8+ RESET=' \033[0m'
9+ GREEN=' \033[0;32m'
10+ RED=' \033[0;31m'
11+
212
313if ! head -1 " $1 " | grep -qE " ^(feat|fix|chore|docs|test|style|refactor|perf|build|ci|revert)(!?)(\(.+?\))?: .{1,}$" ; then
4- echo " Aborting commit. Message must follow the pattern '<type>: <description>' (https://www.conventionalcommits.org/en/v1.0.0/)" >&2
14+ echo -e " ${RED} \nAborting commit. Your commit message is invalid.\n" >&2
15+ echo " An example of a valid message is: " >&2
16+ echo " feat(login): add the 'remember me' checkbox" >&2
17+ echo " More details at: https://www.conventionalcommits.org/en/v1.0.0/#summary" >&2
518 exit 1
619fi
7- if ! head -1 " $1 " | grep -qE " ^.{1,72}$" ; then
8- echo " Aborting commit. Your commit message is too long" >&2
20+ if ! head -1 " $1 " | grep -qE " ^.{1,50}$" ; then
21+ echo -e " ${RED} \nAborting commit. Your commit message is too long." >&2
22+ echo " Maximum length is 50 characters" >&2
923 exit 1
10- fi
24+ fi
You can’t perform that action at this time.
0 commit comments