Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/reject-conventional-commits.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Commit Style

on:
pull_request:
branches: ["**"]

permissions: {}

jobs:
reject-conventional-commits:
runs-on: ubuntu-slim
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 25
persist-credentials: false

- name: Check commit titles
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
shell: bash
run: |
set -euo pipefail
pattern='^(feat|fix|chore|refactor|perf|ci)(\([^)]*\))?!?:'
violations=()
while IFS= read -r title; do
if [[ "$title" =~ $pattern ]]; then
violations+=("$title")
fi
done < <(git log --format=%s "${BASE_SHA}..${HEAD_SHA}")
if (( ${#violations[@]} > 0 )); then
echo "Conventional commit prefixes are not allowed. Found:"
printf ' - %s\n' "${violations[@]}"
exit 1
fi
Comment thread
SMillerDev marked this conversation as resolved.
echo "OK — no conventional commit prefixes found."
Loading