Skip to content

chore: update action conventional commits #18

chore: update action conventional commits

chore: update action conventional commits #18

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_MSG='^(feat|fix|docs|style|refactor|perf|test|chore)(\(.+\))?: .{1,100}$'
if [[ ! $COMMIT_MSG =~ $PATTERN_MSG ]]; then
echo "Invalid commit message format. Must match pattern: /^(feat|fix|docs|style|refactor|perf|test|chore)(\(.+\))?: .{1,100}$/"
exit 1
fi
- name: Check commit description
run: |
COMMIT_DESC=$(git log --format=%b -n 1 ${{ github.sha }})
PATTERN_DESC='^.{1,200}$'
if [[ ! $COMMIT_DESC =~ $PATTERN_DESC ]]; then
echo "Invalid commit description format. Must be up to 200 characters long."
exit 1
fi