Skip to content

Commit

Permalink
feat: Updated scripts/githooks/commit-msg
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] authored Dec 27, 2023
1 parent ff75477 commit 272f6b0
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions scripts/githooks/commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,25 @@ $GITLINT_DIR \
--body-regex=".*" \
--max-parents=1

if [ $? -ne 0 ]
then
if ! command -v $GITLINT_DIR &>/dev/null; then
printError "$GITLINT_DIR not found. Please run 'make tools' OR 'make tools.verify.go-gitlint' make verto install it."
if ! command -v $GITLINT_DIR &>/dev/null; then
printMessage "$GITLINT_DIR not found. Attempting to download and install go-gitlint."
mkdir -p $(dirname $GITLINT_DIR)
curl -L https://github.com/gitlint/gitlint/releases/download/v0.15.0/gitlint-0.15.0.tar.gz | tar xz -C $(dirname $GITLINT_DIR)
if [ $? -ne 0 ]; then
printError "Failed to download and install go-gitlint. Please manually install it and try again."
exit 1
fi
fi

$GITLINT_DIR \
--msg-file=$1 \
--subject-regex="^(build|chore|ci|docs|feat|feature|fix|perf|refactor|revert|style|test)(.*)?:\s?.*" \
--subject-maxlen=150 \
--subject-minlen=10 \
--body-regex=".*" \
--max-parents=1

if [ $? -ne 0 ]; then
printError "Please fix your commit message to match kubecub coding standards"
printError "https://gist.github.com/cubxxw/126b72104ac0b0ca484c9db09c3e5694#file-githook-md"
exit 1
Expand Down

0 comments on commit 272f6b0

Please sign in to comment.