Konano/arknights-mower

View on GitHub
.github/git-hooks/commit-msg

Summary

Maintainability
Test Coverage
#!/bin/bash

# https://www.conventionalcommits.org/zh-hans/v1.0.0-beta.4/

COMMIT_MESSAGE=`cat $1`
COMMIT_RE="^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|release|hotfix|workflow|update|typo)(\(.+\))?: .{1,100}"
MERGE_RE="^Merge "

if [[ ! $COMMIT_MESSAGE =~ $COMMIT_RE ]] && [[ ! $COMMIT_MESSAGE =~ $MERGE_RE ]]
then
    echo "Illegal commit message format:"
    echo $COMMIT_MESSAGE
    echo ""
    echo "Please use the correct format."
    exit 1
fi

exit 0