Stop Copy-Pasting Conventional Commits Rules: Auto-Fix Your Commits in CI
Описание и применение
Автоматическое исправление сообщений коммитов и PR в CI с помощью GitHub Action, поддерживающего правила Conventional Commits, включая маршрутизацию для монорепозиториев и генерацию SARIF.
Задача
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.
Результат
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.
Рабочий процесс
- 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.
Доказательства
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.
- Дата записи: 2026-10-13T13:41:04.062Z