Skip to content

feat: check PR description begins with "This PR"#40

Draft
kim-em wants to merge 2 commits into
masterfrom
feat-check-pr-description-begins-with-this-pr
Draft

feat: check PR description begins with "This PR"#40
kim-em wants to merge 2 commits into
masterfrom
feat-check-pr-description-begins-with-this-pr

Conversation

@kim-em
Copy link
Copy Markdown
Contributor

@kim-em kim-em commented May 22, 2026

This PR adds a small scripts/pr_description/check_description.sh script that fails if a PR body does not begin (after any leading blank lines and whitespace) with the literal phrase "This PR". The accompanying failure message is written to stderr and is intended to be reused verbatim as the body of a sticky PR comment.

The motivation is to make the first sentence of every PR description usable as a release note. Today many PRs open with ## Summary or a bare bullet list, which means the first sentence going into release notes is structural noise rather than a description of the change.

The check is intentionally minimal: it only requires that the first non-blank line starts with This PR. The failure message says explicitly that it's nice if the description goes on to discuss the changes, their motivation, and any advice for downstream users, but that the bare minimum is one sentence saying what the PR does.

The companion workflow that invokes this script lives in mathlib4 and will follow in a separate PR.

🤖 Prepared with Claude Code

kim-em and others added 2 commits May 22, 2026 08:41
Adds scripts/pr_description/check_description.sh, a small shell script
that reads a PR body and exits non-zero unless the first non-blank line
starts with "This PR". The failure message printed on stderr is written
so it can be used directly as the body of a sticky PR comment.

The companion workflow lives in mathlib4 and will be added separately.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… indentation

Address review feedback:

- Require a literal space after `This PR` (was a glob, so `This PRs`,
  `This PR-foo`, `This PR.adds`, `This PR:` and bare `This PR` all
  spuriously passed).
- Skip leading blank lines and HTML comments (single- and multi-line)
  so a PR template that opens with `<!-- ... -->` doesn't fail the check.
- Stop stripping leading whitespace from the first content line so
  indented markdown code blocks (4-space) don't pass.
- Strip a trailing CR so CRLF line endings work.
- Tighten the failure message's first line to match the new rule.
- Document that the companion workflow should run only on open PRs,
  so the check doesn't fire on closed/merged bodies that bors may
  have rewritten.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant