commit 5229e424abcd521cf1146d5171ce80f77986938e parent 4a528dbd87730649a52ee211f606ea068bd44eb3 Author: Pollux <pollux@pollux.codes> Date: Sun, 9 Feb 2025 22:57:02 -0600 feat(shared): add commit-msg hook This hook enforces conventional commits. Spec: https://www.conventionalcommits.org/en/v1.0.0/#specification Signed-off-by: Pollux <pollux@pollux.codes> Diffstat:
A | shared/commit-msg | | | 8 | ++++++++ |
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/shared/commit-msg b/shared/commit-msg @@ -0,0 +1,8 @@ +#!/bin/sh + +# Check commit header +REGEX="^(feat|fix|docs|chore|style|wip)(\([a-z \-]+\))?!?: .{1,50}$" +cat "$1" | head -n1 | grep -E "$REGEX" > /dev/null || (echo "Improper commit header" && exit 1) + +# Check for signed-off-by footer +cat "$1" | grep "^[^#]" | tail -n1 | grep -E "^Signed-off-by: " > /dev/null || (echo "No signed-off-by footer" && exit 1)