31 lines
850 B
YAML
31 lines
850 B
YAML
|
name: Check Commit Messages
|
||
|
|
||
|
on:
|
||
|
push:
|
||
|
paths-ignore:
|
||
|
- '**/*.sh' # Commit messages are checked regardless of file type
|
||
|
pull_request:
|
||
|
paths-ignore:
|
||
|
- '**/*.sh'
|
||
|
|
||
|
jobs:
|
||
|
check-commit-message:
|
||
|
runs-on: docker
|
||
|
container:
|
||
|
image: node:16-bullseye # Node.js pre-installed, based on Debian
|
||
|
|
||
|
steps:
|
||
|
- name: Checkout Code
|
||
|
uses: https://code.forgejo.org/actions/checkout@v4
|
||
|
with:
|
||
|
fetch-depth: 0 # Fetch the entire history to avoid REST API reliance
|
||
|
|
||
|
- name: Check Commit Messages
|
||
|
run: |
|
||
|
echo "Checking commit message format..."
|
||
|
if ! git log -1 --pretty=%B | grep -Eq '^(feat|fix|chore|docs|style|refactor|test|perf):'; then
|
||
|
echo "Commit message does not follow the conventional format: <type>: <subject>"
|
||
|
exit 1
|
||
|
fi
|
||
|
|