Skip to content

feat: update commit_message.yml #8

feat: update commit_message.yml

feat: update commit_message.yml #8

name: Check Commit Message
on:
push:
branches:
- main
jobs:
check_commit_message:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Check commit message
run: |
COMMIT_MSG=$(git log --format=%B -n 1 ${{ github.sha }})
PATTERN='^(feat|fix|docs|style|refactor|perf|test|chore)(\(.+\))?: .{1,100}$'
if [[ ! $COMMIT_MSG =~ $PATTERN ]]; then
echo "Invalid commit message format. Must match pattern: /^(feat|fix|docs|style|refactor|perf|test|chore)(\(.+\))?: .{1,100}$/"
exit 1
fi