Skip to content

Instantly share code, notes, and snippets.

@zstix
Last active June 24, 2021 19:20
Show Gist options
  • Save zstix/7c63d620cdfaf83608e190c0ec3a0457 to your computer and use it in GitHub Desktop.
Save zstix/7c63d620cdfaf83608e190c0ec3a0457 to your computer and use it in GitHub Desktop.
#!/bin/sh
RED='\033[0;31m'
RESET='\033[0m'
UNDERLINE='\033[4m'
REGEX="^(revert|feat|fix|ci|chore|docs|test|style|refactor)(\(.+?\))?:.{1,}$"
if ! head -1 "$1" | grep -qE $REGEX; then
echo "${RED}Commit message invalid: please use conventional commits${RESET}"
echo "See ${UNDERLINE}https://www.conventionalcommits.org/en/v1.0.0/#specification${RESET} for more information"
exit 1;
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment