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#
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 }}
0 commit comments