Skip to content

Instantly share code, notes, and snippets.

@mxchinegod
Last active January 27, 2023 18:12
Show Gist options
  • Save mxchinegod/d99a7494c8b84c2e99fce28468334aa5 to your computer and use it in GitHub Desktop.
Save mxchinegod/d99a7494c8b84c2e99fce28468334aa5 to your computer and use it in GitHub Desktop.
commit-msg git hook to force Angular conventions!
#!/bin/bash
REGEX="(feat|fix|docs|ui|chore|locale)\((refactor|perf|workflow|build|CI|typos|tests|types|wip|release|dep)\):\s.+"
if ! grep -iqE "$REGEX" "$1"; then
echo "Invalid commit message format. Use the following format: [emoji] [revert: ?]<type>[(scope)?]: <message>"
echo "e.g. '🎨 feat(workflow): Added commit-msg hook'"
exit 1
else
pre-commit
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment