Skip to content

ci: detect breaking-change commits in PRs#350

Merged
MarioCadenas merged 3 commits intomainfrom
ci/pr-breaking-change-check
May 6, 2026
Merged

ci: detect breaking-change commits in PRs#350
MarioCadenas merged 3 commits intomainfrom
ci/pr-breaking-change-check

Conversation

@MarioCadenas
Copy link
Copy Markdown
Collaborator

@MarioCadenas MarioCadenas commented May 6, 2026

Summary

Adds a breaking-change detector to the existing PR metadata workflow. Every commit in a PR is scanned for Conventional Commits breaking-change markers, and the merge is gated.

  • Renames pr-title.ymlpr-metadata.yml (workflow name PR Metadata Verification) and adds detect-breaking as a second job alongside the existing title check.
  • Walks git rev-list base..head over the paths tracked by .release-it.json (packages/appkit, packages/appkit-ui, packages/shared) so docs/tooling-only commits don't trigger noise.
  • Detection lives in tools/detect-breaking-commits.ts (TS, run with node via Node 24's native type stripping — no extra install/transpile step), consistent with the rest of tools/*.ts.
  • Matches both subject markers (feat!:, feat(scope)!:, etc. across all conventional types) and BREAKING CHANGE: / BREAKING-CHANGE: footers.
  • Upserts a sticky PR comment via actions/github-script@v7.0.1 (identified by an HTML-comment marker so re-runs update/remove the same comment).
  • Fails the job unless the PR carries an allow-breaking-change label, providing an explicit escape hatch for intentional major bumps.

Today, .release-it.json has bumpStrict: true, so a single BREAKING CHANGE: or feat! commit landing on main silently forces a major version on the next release. This check makes that visible at PR time.

Follow-ups (not in this PR)

  • Update main branch protection required status checks: the previous PR Title / Conventional Commit Title check is now PR Metadata Verification / Conventional Commit Title, and add PR Metadata Verification / Detect Breaking Commits so the merge button is actually blocked.
  • Create the allow-breaking-change label so reviewers can opt in when a major bump is intentional.
  • If main is configured for squash merge, the per-commit messages are discarded on merge and release-it only sees the squash commit (already covered by the title check); in that case this check is informational. With merge commit or rebase merge strategies, the check is load-bearing.

Test plan

  • On the PR for this branch, confirm both jobs run under PR Metadata Verification and the breaking-change job reports "no breaking commits found" (no comment posted, job green).
  • In a follow-up scratch PR, push a commit like feat(appkit)!: test breaking marker touching packages/appkit/** and verify:
    • Sticky comment appears listing the SHA + subject.
    • Job fails red.
    • Adding the allow-breaking-change label re-runs the workflow and turns it green; comment updates to acknowledge the intentional bump.
    • Removing the label flips it back to red.
  • Push a commit with feat!: touching docs/** only and confirm the check stays green (path filter working).
  • Amend the breaking commit away and verify the sticky comment is deleted on the next workflow run.
image

@MarioCadenas MarioCadenas requested a review from a team as a code owner May 6, 2026 11:15
@MarioCadenas MarioCadenas requested a review from pkosiec May 6, 2026 11:15
@MarioCadenas MarioCadenas force-pushed the ci/pr-breaking-change-check branch from 0de2b5f to fe49bf2 Compare May 6, 2026 11:20
Adds a workflow that scans every commit in a pull request for
Conventional Commits breaking-change markers (`type!:` or
`BREAKING CHANGE:` footer) limited to the packages tracked by
.release-it.json (appkit, appkit-ui, shared).

When a breaking commit is found, the job posts a sticky PR comment
explaining the major-version impact and fails the check, unless the
PR carries an `allow-breaking-change` label. This prevents accidental
major bumps from landing on main once the new check is added to
branch-protection required checks.

Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
@MarioCadenas MarioCadenas force-pushed the ci/pr-breaking-change-check branch from fe49bf2 to 85f7249 Compare May 6, 2026 11:24
Comment thread .github/workflows/pr-metadata.yml
Comment thread .github/scripts/detect-breaking-commits.sh Outdated
…ctor in TS

Addresses review feedback on #350:

- Merge `pr-title.yml` and `pr-breaking-change.yml` into a single
  `pr-metadata.yml` workflow ("PR Metadata Verification") with two
  jobs: `check-title` and `detect-breaking`.
- Move the breaking-commit scan from a bash script to
  `tools/detect-breaking-commits.ts`, matching the rest of `tools/*.ts`.
- Run the TS script directly with `node` (Node 24 native type
  stripping) so the job stays lightweight — no pnpm install or
  tsx transpile step.
@MarioCadenas MarioCadenas changed the title ci: detect breaking-change commits in PRs feat!: detect breaking-change commits in PRs May 6, 2026
The previous detector only walked per-commit messages, so a PR with a
title like `feat!: foo` or with `BREAKING CHANGE:` in the description
would slip through even though both surfaces feed `release-it` after a
squash merge (title becomes the squash subject, description can land in
the squash body).

Pass `PR_TITLE` and `PR_BODY` into the detector and group hits by
source (title / description / commits) in the sticky PR comment.
@MarioCadenas MarioCadenas changed the title feat!: detect breaking-change commits in PRs ci: detect breaking-change commits in PRs May 6, 2026
@MarioCadenas MarioCadenas changed the title ci: detect breaking-change commits in PRs feat!: detect breaking-change commits in PRs May 6, 2026
@MarioCadenas MarioCadenas changed the title feat!: detect breaking-change commits in PRs ci: detect breaking-change commits in PRs May 6, 2026
@MarioCadenas MarioCadenas merged commit d629f11 into main May 6, 2026
13 of 17 checks passed
@MarioCadenas MarioCadenas deleted the ci/pr-breaking-change-check branch May 6, 2026 16:55
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.

3 participants