Skip to content

ci: check that PR titles are conventional commit subjects - #1464

Merged
robinnsc merged 1 commit into
mainfrom
ci/pr-title-check
Dec 2, 2026
Merged

robinnsc merged 1 commit into
mainfrom
ci/pr-title-check

Conversation

@robinnsc

@robinnsc robinnsc commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Release automation (#1395), PR 1 of 6. Stack: #1464 PR title check ← #1465 signing in a called workflow ← #1466 freeze-migrations ← #1467 release-please ← #1468 rehearsal ← #1469 release-publish. Merge in that order.

What

Adds a PR title check, the conventional job of the new "PR title" workflow, which fails when a PR title is not a conventional commit subject: type(scope)!: summary, with the scope and ! optional.

  • devtools/check-pr-title holds the rule and names the part that failed (shape, type, scope, or the space after the colon). The types are commitlint's config-conventional eleven: build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test.
  • The workflow runs on opened, edited, reopened and synchronize. The title reaches the script through the environment. It checks out devtools/ from the default branch, so a PR that edits the checker is checked by main's version, and an older or stacked PR whose base has no checker still gets one. The workflow file itself runs from the PR's merge ref, as every pull_request workflow does, so a change to it is protected by review only. Until main has the checker (this PR and the PRs stacked on it), the job falls back to the PR's own copy, which trusts the PR no more than running the workflow file from its merge ref does. A merge-queue run has no title, so the job is skipped there, which counts as passing.
  • CONTRIBUTING.md says how to title a PR and a revert.

It changes nothing else. It is the first PR of the release automation stack: #1467 extends its CONTRIBUTING.md item.

Why

Part of #1395. The release automation builds the changelog and the next version from the commit subjects on main. Most subjects already have the conventional shape, but nothing checks it: in the 0.1.15 cycle two squash-merged titles did not, and seven merge commits brought 24 more non-conventional subjects to main, 20 of them merges into PR branches.

Testing done

  • Unit tests for the checker, including every case that a mutation run of the script showed untested; all mutants are killed.
  • Each accepted title in a set of 61 test titles and 200 subjects from main parses with release-please 17.6.0's parser to the same type, scope and breaking flag. On the last 300 subjects on main it refuses only merge commits, non-conventional subjects and devtools: types.
  • actionlint and devtools/check-actions-pinned are clean.
  • Until main has the checker, the job uses the PR's own copy, so the check also passes on this PR and on the PRs stacked on it.

Settings to apply when this merges

An admin applies these, in this order:

  • Allow squash merging only: repository settings, the main ruleset's allowed merge methods, and the merge queue's merge method.
  • Under "Allow squash merging", set the default commit message to "Pull request title and description". A squash commit then takes the PR title as its subject. With the current "Default message", a single-commit PR's squash subject is the commit's subject, which this check does not see.
  • Then add conventional (GitHub Actions) to main's required status checks. They live in branch protection, not in the main ruleset.

Checklist

  • I have read CONTRIBUTING.md
  • All tests pass (cargo test --workspace): not run, no Rust change; devtools unit tests pass
  • Code is formatted (cargo fmt --check): no Rust change
  • Clippy is clean (cargo clippy -- -W clippy::pedantic): no Rust change
  • I have added or updated tests for new functionality
  • I have updated documentation if behavior changed
  • Breaking changes are noted below (if any)
  • If this changes the wire protocol, Storage trait, auth model, on-disk
    format, or public CLI surface, an RFC has been accepted or is linked
    below. Otherwise, an ADR captures the decision (link below).

ADR / RFC: n/a: CI and release tooling only; the design is discussed in #1395

Breaking changes

None for users. Contributors' PR titles must follow the format once the check is required.


By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache License 2.0 and I agree to the Developer Certificate of
Origin (DCO). See CONTRIBUTING.md for details.

This adds a PR title check, the `conventional` job of the PR title
workflow, which fails when a PR title is not a conventional commit
subject. It changes nothing else. It relies on merge settings that the
admin applies when this merges (last paragraph).

The release automation tracked in #1395 will build the changelog from
the commit subjects on main. Most subjects on main have the
conventional shape, but nothing checks it; for example #596's
(b0d1c64) does not. In the 0.1.15 cycle two squash-merged PR titles
did not have it, and seven merge commits brought 24 more subjects to
main that do not have it.

devtools/check-pr-title accepts `type(scope)!: summary`, with the scope
and the `!` optional. The type is one of the eleven of commitlint's
config-conventional: build, chore, ci, docs, feat, fix, perf, refactor,
revert, style and test. A scope is lowercase letters, digits, `.`, `_`,
`/` and `-`. A refusal names the rule that failed: the shape, the type,
the scope or the space after the colon.

The PR title workflow runs it on opened, edited, reopened and
synchronize events. The title reaches the script through the
environment. The job checks out devtools/ (in cone mode, also the files
at the repository root) from the default branch, so a PR that edits the
checker is checked by main's version, and an older or stacked PR whose
base has no checker still gets main's. The workflow file itself runs
from the PR's merge ref, as every pull_request workflow does, so a
change to it is protected by review only. Until main has a checker, on
this PR and the PRs stacked on it, the job uses the PR's own copy. A
merge queue run has no title, so the job is skipped there, which counts
as passing if the check is made required. CONTRIBUTING.md says how to
title a PR and a revert.

Settings to apply when this merges: allow squash merging only, in the
repository settings, the main ruleset's allowed merge methods and the
merge queue's merge method. Under "Allow squash merging", set the
default commit message to "Pull request title and description" (API:
squash_merge_commit_title PR_TITLE, squash_merge_commit_message
PR_BODY). A squash commit then takes the PR title as its subject and
the PR description as its message. With the current "Default message",
a single-commit PR's squash subject is the commit's subject, which this
check does not see. Then add `conventional` (GitHub Actions) to main's
required status checks. Merge this before the release-please change of
#1395 (#1467), which builds on its CONTRIBUTING.md text.

Signed-off-by: Scott Robinson <robinnsc@amazon.com>
@robinnsc
robinnsc added this pull request to the merge queue Dec 2, 2026
Merged via the queue into main with commit aff626e Dec 2, 2026
64 of 65 checks passed
@robinnsc
robinnsc deleted the ci/pr-title-check branch December 2, 2026 02:11
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.

2 participants