Skip to content

Commit 01ed3e0

Browse files
authored
Merge pull request #6 from btravstack/fix/changesets-action-v2
fix(release): bump changesets/action to v2, and pin the checkout
2 parents c98f65e + 57041da commit 01ed3e0

2 files changed

Lines changed: 57 additions & 14 deletions

File tree

‎.github/workflows/release-reusable.yml‎

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
# release:
1212
# if: ${{ github.event.workflow_run.conclusion == 'success' }}
1313
# uses: btravstack/tools/.github/workflows/release-reusable.yml@main
14+
# with:
15+
# ref: ${{ github.event.workflow_run.head_sha }}
1416
# secrets:
1517
# RELEASE_PAT: ${{ secrets.RELEASE_PAT }}
1618
#
@@ -30,6 +32,17 @@ on:
3032
description: "Command changesets/action runs to publish."
3133
type: string
3234
default: "pnpm run release"
35+
ref:
36+
description: >
37+
Commit to check out. A caller on `workflow_run` should pass
38+
`github.event.workflow_run.head_sha` — the exact commit the green run
39+
measured. Without it a `workflow_run` checkout takes the default
40+
branch's CURRENT tip, which a push landing after CI went green can
41+
have moved, and the release then carries a commit no CI run
42+
validated. Empty is checkout's own default, so omitting it keeps the
43+
previous behaviour.
44+
type: string
45+
default: ""
3346
secrets:
3447
RELEASE_PAT:
3548
description: "PAT with Contents + Pull requests write (fires CI on the release PR)."
@@ -48,31 +61,47 @@ jobs:
4861
- name: Checkout
4962
uses: actions/checkout@v7
5063
with:
64+
ref: ${{ inputs.ref }}
5165
# PAT so the release PR is created with credentials that DO fire
5266
# `pull_request` workflows (the bare GITHUB_TOKEN push is treated as a
5367
# bot event and would skip CI on the "Version Packages" branch).
5468
token: ${{ secrets.RELEASE_PAT }}
5569

5670
- name: Setup pnpm
57-
uses: pnpm/action-setup@v4
71+
uses: pnpm/action-setup@v6
5872

5973
- name: Setup Node.js
60-
uses: actions/setup-node@v4
74+
uses: actions/setup-node@v7
6175
with:
6276
node-version-file: .node-version
6377
cache: pnpm
6478

6579
- name: Install
6680
run: pnpm install --frozen-lockfile
6781

82+
# v2, not v1, and the reason is a real failure rather than hygiene: v1
83+
# bundles `@changesets/read@^0.6.7`, which parses EVERY `.changeset/*.md`
84+
# as a changeset. A repository keeping agent guidance beside its
85+
# changesets — `.changeset/CLAUDE.md` — fails the whole release with
86+
# `could not parse changeset - missing or invalid frontmatter`, which is
87+
# what happened to btravstack/btravstack. `@changesets/read@1.0.0`, which
88+
# v2 bundles, ignores `README.md`, `AGENTS.md`, `CLAUDE.md` and
89+
# `GEMINI.md`.
90+
#
91+
# v2 renamed every input; the pairs are version->version-script,
92+
# publish->publish-script, commit->commit-message, title->pr-title.
6893
- name: Create Release Pull Request or Publish to npm
69-
uses: changesets/action@v1
94+
uses: changesets/action@v2
7095
with:
71-
version: ${{ inputs.version-command }}
72-
publish: ${{ inputs.publish-command }}
73-
commit: "chore: release packages"
74-
title: "chore: release packages"
96+
# An INPUT now, not just the env below. v2 gives `github-token` a
97+
# default of `${{ github.token }}`, so passing the PAT only through
98+
# the environment would silently fall back to the bot token — and a
99+
# release PR opened by it starts no workflow runs, which is the exact
100+
# thing the PAT exists to prevent.
101+
github-token: ${{ secrets.RELEASE_PAT }}
102+
version-script: ${{ inputs.version-command }}
103+
publish-script: ${{ inputs.publish-command }}
104+
commit-message: "chore: release packages"
105+
pr-title: "chore: release packages"
75106
env:
76-
# PAT (not GITHUB_TOKEN): GITHUB_TOKEN-triggered events don't start new
77-
# workflow runs, so the "Version Packages" PR would otherwise skip CI.
78107
GITHUB_TOKEN: ${{ secrets.RELEASE_PAT }}

‎.github/workflows/release.yml‎

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ jobs:
2727
- name: Checkout
2828
uses: actions/checkout@v7
2929
with:
30+
# The exact commit the green CI run measured, never the branch tip: a
31+
# `workflow_run` checkout otherwise takes the default branch's CURRENT
32+
# tip, which a push landing after CI went green can have moved.
33+
ref: ${{ github.event.workflow_run.head_sha || github.sha }}
3034
# PAT so the git remote is configured with PAT credentials; the bare
3135
# GITHUB_TOKEN push checkout normally sets up is treated as a bot
3236
# event and would not fire `pull_request` workflows on the resulting
@@ -38,14 +42,24 @@ jobs:
3842

3943
- name: Create Release Pull Request or Publish to npm
4044
id: changesets
41-
uses: changesets/action@v1
45+
# v2, not v1: v1 bundles `@changesets/read@^0.6.7`, which parses EVERY
46+
# `.changeset/*.md` as a changeset and fails the whole release on a
47+
# repository that keeps `.changeset/CLAUDE.md` beside its changesets.
48+
# `@changesets/read@1.0.0` — v2's — ignores `README.md`, `AGENTS.md`,
49+
# `CLAUDE.md` and `GEMINI.md`. v2 also renamed every input.
50+
uses: changesets/action@v2
4251
with:
52+
# An INPUT now: v2 defaults `github-token` to `${{ github.token }}`,
53+
# so passing the PAT only through the environment below would
54+
# silently fall back to the bot token, and a release PR opened by it
55+
# starts no workflow runs — the exact thing the PAT prevents.
56+
github-token: ${{ secrets.RELEASE_PAT }}
4357
# Use `pnpm run …` so we invoke the package.json scripts. Bare
4458
# `pnpm version` collides with pnpm's built-in `version` command.
45-
version: pnpm run version
46-
publish: pnpm run release
47-
commit: "chore: release packages"
48-
title: "chore: release packages"
59+
version-script: pnpm run version
60+
publish-script: pnpm run release
61+
commit-message: "chore: release packages"
62+
pr-title: "chore: release packages"
4963
env:
5064
# PAT rather than GITHUB_TOKEN: events triggered by GITHUB_TOKEN do
5165
# not start new workflow runs (anti-recursion safeguard), so the

0 commit comments

Comments
 (0)