Skip to content

ci: validate PR title against Conventional Commits#635

Merged
bdraco merged 1 commit into
mainfrom
koan/pr-title-lint
May 15, 2026
Merged

ci: validate PR title against Conventional Commits#635
bdraco merged 1 commit into
mainfrom
koan/pr-title-lint

Conversation

@bluetoothbot
Copy link
Copy Markdown
Contributor

@bluetoothbot bluetoothbot commented May 15, 2026

What

Add a GitHub Actions workflow that validates the pull request title against the Conventional Commits spec.

Why

GitHub uses the PR title — not the first commit's subject — as the commit message when "Squash and merge" is used. The existing commitlint job in ci.yml only lints individual commit messages, so a malformed PR title still produces an invalid commit on main even when every commit on the branch passes. Fixes #531.

How

  • New workflow .github/workflows/pr-title.yml runs amannn/action-semantic-pull-request@v6.1.1 (pinned to SHA, matching the rest of the repo).
  • Uses pull_request_target so external/fork PRs can be validated safely (only PR metadata is read; permissions: pull-requests: read).
  • Types mirror @commitlint/config-conventional (build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test).
  • subjectPattern: ^(?![A-Z]).+$ enforces lowercase first letter to match commitlint's subject-case rule.
  • Triggers on opened / edited / synchronize / reopened so the check stays current as the title is edited.

Testing

  • python3 -c \"import yaml; yaml.safe_load(...)\" confirms the workflow file parses.
  • Action SHA verified against the upstream v6.1.1 tag.
  • Regex sanity-checked against representative PR titles (lowercase pass, capitalized fail).
  • Full end-to-end validation will happen on this very PR — the new workflow will run against this title, which itself follows the conventional-commits format.

Quality Report

Changes: 1 file changed, 52 insertions(+)

Code scan: clean

Tests: failed ([Errno 13] Permission denied: 'pytest')

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

GitHub uses the pull request title (not the first commit subject) for
"Squash and merge" commits, but the existing commitlint job only
validates individual commit messages. A mis-formatted PR title
therefore produces an invalid commit on main even when every commit
on the branch is fine.

Add a workflow that runs amannn/action-semantic-pull-request against
the PR title on every open/edit/synchronize/reopen, using the same
type set as @commitlint/config-conventional and enforcing
lowercase-subject to mirror commitlint's subject-case rule.

Fixes #531
@codecov
Copy link
Copy Markdown

codecov Bot commented May 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.06%. Comparing base (7edf99f) to head (4c0a536).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #635      +/-   ##
==========================================
- Coverage   86.12%   86.06%   -0.06%     
==========================================
  Files          29       29              
  Lines        3488     3488              
  Branches      602      602              
==========================================
- Hits         3004     3002       -2     
- Misses        299      300       +1     
- Partials      185      186       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 15, 2026

Merging this PR will not alter performance

✅ 6 untouched benchmarks


Comparing koan/pr-title-lint (4c0a536) with main (7edf99f)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (bce3ac8) during the generation of this report, so 7edf99f was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a dedicated GitHub Actions workflow to lint pull request titles against the Conventional Commits format, ensuring squash-merge commit subjects remain valid even when individual commits already pass commitlint.

Changes:

  • Introduces .github/workflows/pr-title.yml to validate PR titles using amannn/action-semantic-pull-request (pinned to a commit SHA).
  • Runs on pull_request_target with restricted permissions (pull-requests: read) to safely validate titles for forked PRs.
  • Enforces a lowercase-first-character subject convention via subjectPattern.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bdraco bdraco marked this pull request as ready for review May 15, 2026 02:04
@bdraco bdraco merged commit 7fca763 into main May 15, 2026
27 of 28 checks passed
@bdraco bdraco deleted the koan/pr-title-lint branch May 15, 2026 02:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

github actions needs to check pull request title

3 participants