ci(changeset): auto-generate the changeset from the PR template's Release section#71
Open
AakashHotchandani wants to merge 1 commit into
Open
ci(changeset): auto-generate the changeset from the PR template's Release section#71AakashHotchandani wants to merge 1 commit into
AakashHotchandani wants to merge 1 commit into
Conversation
…ease section Engineers fill the mandatory '## Release' section (version bump minor/patch + release notes) — already enforced by ready-for-review-label.yml. This adds a workflow that READS that section and writes .changeset/pr-<number>.md for them, so nobody hand-runs 'npx changeset' (and canaries/releases never no-op for a missing changeset). - New .github/workflows/changeset-from-pr.yml: a single actions/github-script step (no run: shell — untrusted PR body/title/head.ref are read as JS context vars, never interpolated; pull_request not pull_request_target; forks skipped). Parses the bump tick + notes exactly like the ready-for-review gate; commits an idempotent .changeset/pr-<number>.md to the PR branch via the GitHub API (no commit when unchanged, so the bot's own push settles in one no-op pass). Summary prefers customer-facing notes, falls back to internal, then PR title. Skips forks, the changeset-release/* Version PR, and skip-changeset-labelled PRs. - PR template: note that the changeset is auto-generated (no npx changeset needed) + the skip-changeset escape hatch. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Right now a canary/release silently no-ops when a PR merges without a changeset (that's what left
mainwith none and made the last Release run green-but-empty). Rather than ask engineers to hand-runnpx changeset, generate it from the PR template they already fill.The mandatory
## Releasesection (version bumpminor/patch+ customer-facing/internal notes) and its enforcement (ready-for-review-label.yml) are already in the repo (ported in #57). This PR adds the missing half: a workflow that reads that section and writes the changeset.What
.github/workflows/changeset-from-pr.yml— on PR open/edit/sync it parses the## Releaseblock (same parser as the ready-for-review gate: oneminor|patchtick + the notes) and commits.changeset/pr-<number>.mdto the PR branch:synchronize) settles in one no-op pass; body edits update it in place.changeset-release/*), andskip-changeset-labelled PRs (CI/docs/chore).ready-for-review-label.ymlstill independently requires the bump + internal notes; this workflow only generates when they're valid.PR template — one line noting the changeset is auto-generated (no
npx changeset) + theskip-changesetescape hatch.Security
Single
actions/github-scriptstep — norun:shell, so untrustedpull_request.body/title/head.refare read as JScontextvars, never interpolated into a command. Usespull_request(notpull_request_target) and skips forks, so thecontents: writetoken only ever writes the author's own same-repo branch (which they can already push to). No privilege escalation, no injection surface.Result
Engineers just fill the Release section; the changeset appears on the PR automatically → canaries/releases always have something to snapshot. (Complements the
changeset-unblock-canaryPR #69, which added the one-off changeset for the currently-pending fixes.)Create a
skip-changesetlabel in the repo for the escape hatch (theiftreats a missing label as "don't skip", so nothing breaks until it exists).🤖 Generated with Claude Code