Stop Copy-Pasting Conventional Commits Rules: Auto-Fix Your Commits in CI
Description and use
Automated correction of commit and PR messages in CI using a GitHub Action that enforces Conventional Commits, supports per‑package routing in monorepos, and outputs SARIF for GitHub Security.
Problem
Conventional Commits checks fail in CI and fix commits are themselves incorrectly formatted, leading to long PR titles, missing sections, and inconsistent rules across monorepo packages.
Outcome
Automated enforcement and correction of Conventional Commits rules in CI, eliminating manual fixes and configuration duplication in monorepos, while providing SARIF output for security dashboards.
Workflow
- Configure a .github/pr-conventional.yml with desired rules or use an example file (strict.yml, relaxed.yml, monorepo.yml, chinese-team.yml).
- Add a GitHub Actions workflow that checks out the repo and runs the RedSamerai/pr-conventional action (e.g., RedSamerai/[email protected]).
- On each push or PR, the action scans all new commits (up to 20) and the PR title/body. It amends commit messages, appends missing sections, truncates long titles, and re‑validates.
- If the run succeeds, a pr-conventional.sarif file is produced and can be uploaded to GitHub Security via upload-sarif.
Evidence
I wanted one that actually fixes it.
It checks every new commit in the push (before..after, up to 20), the PR title, and the PR body.
Monorepo per-package routing
Every run writes pr-conventional.sarif. Pipe it into upload-sarif and findings land in the GitHub Security tab.
- Record date: 2026-10-13T13:41:04.062Z