From a9cca73b1cdd3858a71e6b7511330c62b8cb204c Mon Sep 17 00:00:00 2001 From: Ian Macartney <366683+ianmacartney@users.noreply.github.com> Date: Tue, 10 Nov 2026 16:29:11 -0800 Subject: [PATCH 1/3] Standardize Changesets version PR template --- .github/workflows/version.yml | 34 ++++++++++++++++++++++++++++++++++ CONTRIBUTING.md | 8 ++++---- package.json | 1 + 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml index 11448c78..f430433b 100644 --- a/.github/workflows/version.yml +++ b/.github/workflows/version.yml @@ -48,12 +48,46 @@ jobs: echo "Skipping release PR update: main has moved beyond this run's commit." fi - name: Create or update the release PR + id: version if: steps.mode.outputs.mode == 'version' && steps.freshness.outputs.current == 'true' uses: changesets/action/version@ae32849d5ba541f9ae29e40e22a623bc13562f51 # v2.1.2 with: github-token: ${{ github.token }} + script: npm run version:ci pr-title: "Prepare next release" commit-message: "Version packages" pr-base-branch: main + - name: Describe staged publishing in the release PR + if: steps.version.outputs['pr-number'] != '' + env: + GH_TOKEN: ${{ github.token }} + PR_NUMBER: ${{ steps.version.outputs['pr-number'] }} + run: | + node --input-type=module <<'NODE' + import { execFileSync } from "node:child_process"; + + const route = `repos/${process.env.GITHUB_REPOSITORY}/pulls/${process.env.PR_NUMBER}`; + const pr = JSON.parse( + execFileSync("gh", ["api", route], { encoding: "utf8" }), + ); + const marker = "# Releases\n"; + const index = pr.body.indexOf(marker); + if (index < 0) throw new Error("Changesets release notes are missing"); + const intro = [ + "This PR was opened by the Changesets version workflow.", + "", + "Merging it stages the tested package on npm through trusted publishing.", + "Review and approve the staged package separately with 2FA.", + "Additional changesets merged into main will update this PR.", + "", + "", + ].join("\n"); + const body = intro + pr.body.slice(index); + if (body !== pr.body) { + execFileSync("gh", ["api", "-X", "PATCH", route, "--input", "-"], { + input: JSON.stringify({ body }), + }); + } + NODE diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a83a9e0b..82a73e52 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -55,12 +55,12 @@ To prepare a release locally instead of using the bot: npm ci npm run build npm run check -npx changeset version +npm run version:ci ``` -Review and commit the version, changelog, and consumed changesets, then merge -through a checked PR. A push to main stages the latest version-bump commit in -that push. +Review and commit the version, lockfile, changelog, and consumed changesets, +then merge through a checked PR. A push to main stages the latest version-bump +commit in that push. For a branch prerelease, prepare a prerelease version with Changesets and dispatch **Release** from the Actions page on that branch. The first prerelease diff --git a/package.json b/package.json index 635ec6ff..be7ea5aa 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "format": "prettier -w .", "format:check": "prettier --check .", "check": "run-p test typecheck lint format:check", + "version:ci": "changeset version && npm install --package-lock-only --ignore-scripts --no-audit --no-fund", "all": "run-p -r 'dev:*' 'test:watch'", "test": "vitest run --typecheck", "test:watch": "vitest --typecheck --clearScreen false", From a8cbe1ba04c0f05ac783467142fa22dc2f83691f Mon Sep 17 00:00:00 2001 From: Ian Macartney <366683+ianmacartney@users.noreply.github.com> Date: Tue, 10 Nov 2026 16:58:45 -0800 Subject: [PATCH 2/3] Use default Changesets version command --- .github/workflows/version.yml | 1 - CONTRIBUTING.md | 8 ++++---- package.json | 1 - 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml index f430433b..592857d0 100644 --- a/.github/workflows/version.yml +++ b/.github/workflows/version.yml @@ -55,7 +55,6 @@ jobs: uses: changesets/action/version@ae32849d5ba541f9ae29e40e22a623bc13562f51 # v2.1.2 with: github-token: ${{ github.token }} - script: npm run version:ci pr-title: "Prepare next release" commit-message: "Version packages" pr-base-branch: main diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 82a73e52..a83a9e0b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -55,12 +55,12 @@ To prepare a release locally instead of using the bot: npm ci npm run build npm run check -npm run version:ci +npx changeset version ``` -Review and commit the version, lockfile, changelog, and consumed changesets, -then merge through a checked PR. A push to main stages the latest version-bump -commit in that push. +Review and commit the version, changelog, and consumed changesets, then merge +through a checked PR. A push to main stages the latest version-bump commit in +that push. For a branch prerelease, prepare a prerelease version with Changesets and dispatch **Release** from the Actions page on that branch. The first prerelease diff --git a/package.json b/package.json index be7ea5aa..635ec6ff 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,6 @@ "format": "prettier -w .", "format:check": "prettier --check .", "check": "run-p test typecheck lint format:check", - "version:ci": "changeset version && npm install --package-lock-only --ignore-scripts --no-audit --no-fund", "all": "run-p -r 'dev:*' 'test:watch'", "test": "vitest run --typecheck", "test:watch": "vitest --typecheck --clearScreen false", From df70aa23f603d811be959e926ed975794e0143d4 Mon Sep 17 00:00:00 2001 From: Ian Macartney <366683+ianmacartney@users.noreply.github.com> Date: Tue, 10 Nov 2026 17:06:49 -0800 Subject: [PATCH 3/3] Use generated Changesets release PR body --- .github/workflows/version.yml | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml index 592857d0..11448c78 100644 --- a/.github/workflows/version.yml +++ b/.github/workflows/version.yml @@ -48,7 +48,6 @@ jobs: echo "Skipping release PR update: main has moved beyond this run's commit." fi - name: Create or update the release PR - id: version if: steps.mode.outputs.mode == 'version' && steps.freshness.outputs.current == 'true' @@ -58,35 +57,3 @@ jobs: pr-title: "Prepare next release" commit-message: "Version packages" pr-base-branch: main - - name: Describe staged publishing in the release PR - if: steps.version.outputs['pr-number'] != '' - env: - GH_TOKEN: ${{ github.token }} - PR_NUMBER: ${{ steps.version.outputs['pr-number'] }} - run: | - node --input-type=module <<'NODE' - import { execFileSync } from "node:child_process"; - - const route = `repos/${process.env.GITHUB_REPOSITORY}/pulls/${process.env.PR_NUMBER}`; - const pr = JSON.parse( - execFileSync("gh", ["api", route], { encoding: "utf8" }), - ); - const marker = "# Releases\n"; - const index = pr.body.indexOf(marker); - if (index < 0) throw new Error("Changesets release notes are missing"); - const intro = [ - "This PR was opened by the Changesets version workflow.", - "", - "Merging it stages the tested package on npm through trusted publishing.", - "Review and approve the staged package separately with 2FA.", - "Additional changesets merged into main will update this PR.", - "", - "", - ].join("\n"); - const body = intro + pr.body.slice(index); - if (body !== pr.body) { - execFileSync("gh", ["api", "-X", "PATCH", route, "--input", "-"], { - input: JSON.stringify({ body }), - }); - } - NODE