Skip to content

Commit bbece9e

Browse files
ci: add Conventional Commits enforcement for PR titles (#337)
* ci: add PR title lint for Conventional Commits Adds a GitHub Action that validates PR titles follow the Conventional Commits format (type(scope): description). Since this repo uses squash-merge, the PR title becomes the commit message on main, which release-please uses for changelog generation. Prevents commits from being silently dropped from the changelog when merged without a conventional prefix. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * docs: clarify PR title convention for release-please in AGENTS.md Expand the commit message section to explain that PR titles are the commit messages (squash-merge), that non-conforming titles are blocked by CI and silently dropped from the changelog, and include a concrete bad/good example to guide agents. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * ci: add PR template with Conventional Commits guidance Adds a pull_request_template.md that reminds authors the PR title becomes the changelog entry via release-please. Includes the format spec, type→changelog mapping, and a bad/good example. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix(ci): replace third-party action with inline regex check The pinned SHA for amannn/action-semantic-pull-request was not resolvable. Replace with a zero-dependency bash regex check that validates PR titles against the Conventional Commits pattern. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 14e7b7f commit bbece9e

3 files changed

Lines changed: 72 additions & 3 deletions

File tree

.github/pull_request_template.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<!--
2+
⚠️ PR TITLE = CHANGELOG ENTRY
3+
This repo uses squash-merge, so your PR title becomes the commit on main.
4+
release-please uses it for the changelog and version bump.
5+
6+
Format: type(scope): description
7+
Example: feat(compile): add S360 Breeze MCP as first-party tool
8+
9+
Types that appear in the changelog:
10+
feat → Features (bumps minor version)
11+
fix → Bug Fixes (bumps patch version)
12+
13+
Types that do NOT appear in the changelog (no version bump):
14+
chore, docs, refactor, test, ci, perf, build
15+
16+
Bad: "Allow workspace to target a repo alias"
17+
Good: "feat(compile): allow workspace to target a repo alias"
18+
-->
19+
20+
## Summary
21+
22+
<!-- Brief description of what this PR does and why. -->
23+
24+
## Test plan
25+
26+
<!-- How was this tested? (cargo test, manual verification, etc.) -->
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: PR Title Lint
2+
3+
on:
4+
pull_request:
5+
types: [opened, edited, synchronize, reopened]
6+
7+
permissions:
8+
pull-requests: read
9+
10+
jobs:
11+
lint:
12+
name: Validate Conventional Commit
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Check PR title
16+
env:
17+
PR_TITLE: ${{ github.event.pull_request.title }}
18+
run: |
19+
# Conventional Commits: type(optional-scope): description
20+
PATTERN='^(feat|fix|chore|docs|refactor|test|ci|perf|build|revert)(\([a-zA-Z0-9_-]+\))?!?: .+'
21+
if echo "$PR_TITLE" | grep -qE "$PATTERN"; then
22+
echo "✅ PR title follows Conventional Commits: $PR_TITLE"
23+
else
24+
echo "::error::PR title must follow Conventional Commits format: type(scope): description"
25+
echo ""
26+
echo " Got: $PR_TITLE"
27+
echo " Expected: type(scope): description"
28+
echo ""
29+
echo " Valid types: feat, fix, chore, docs, refactor, test, ci, perf, build, revert"
30+
echo " Examples:"
31+
echo " feat(compile): add S360 Breeze MCP as first-party tool"
32+
echo " fix: gitattributes writer quote paths with spaces"
33+
echo " chore: update MCPG_VERSION to 0.3.0"
34+
exit 1
35+
fi

AGENTS.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,23 @@ Alongside the correctly generated pipeline yaml, an agent file is generated from
107107

108108
## Development Guidelines
109109

110-
### Commit Message Convention
110+
### Commit Message and PR Title Convention
111111

112-
This project uses [Conventional Commits](https://www.conventionalcommits.org/) for automated releases via `release-please`. All commit messages **must** follow the format:
112+
This project uses [Conventional Commits](https://www.conventionalcommits.org/) for automated releases via `release-please`. **PR titles are the commit messages** — this repo uses squash-merge, so the PR title becomes the commit on `main`.
113+
114+
All PR titles **must** follow the format:
113115

114116
```
115117
type(optional scope): description
116118
```
117119

118-
Common types: `feat`, `fix`, `chore`, `docs`, `refactor`, `test`, `ci`. Commits that don't follow this format will be ignored by release-please and won't trigger a release.
120+
Common types: `feat`, `fix`, `chore`, `docs`, `refactor`, `test`, `ci`. PRs with non-conforming titles will be blocked by CI and, if merged, will be silently dropped from the changelog.
121+
122+
- **`feat`** — triggers a minor version bump and appears under "Features" in the changelog.
123+
- **`fix`** — triggers a patch version bump and appears under "Bug Fixes".
124+
- All other types (`chore`, `docs`, `refactor`, etc.) — no version bump, no changelog entry.
125+
126+
A PR titled `Allow workspace to target a repo alias` will be **ignored** by release-please. The correct title is `feat(compile): allow workspace to target a repo alias`.
119127

120128
### Rust Code Style
121129

0 commit comments

Comments
 (0)