Skip to content

Commit 8562779

Browse files
committed
ci: fix release publish not triggering after Release PR merge
Pushes whose commits originate from the default GITHUB_TOKEN do not trigger downstream workflow runs, so merging the changesets Release PR never ran the publish step (the version bump landed on main but the package was never published to npm). - Use RELEASE_GITHUB_TOKEN (PAT) for checkout + changesets action, with a fallback to GITHUB_TOKEN so behaviour is unchanged until the secret is added. Once set, merging the Release PR cascades into publish. - Add workflow_dispatch as a manual safety valve to re-run publish for a version that was bumped but never published.
1 parent 3b17321 commit 8562779

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

.github/workflows/publish.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on:
44
push:
55
branches:
66
- main
7+
# Manual safety valve: lets us re-run the publish step on demand (e.g. when a
8+
# release got version-bumped but never published). workflow_dispatch is exempt
9+
# from the GITHUB_TOKEN "no recursive runs" rule, so it always triggers.
10+
workflow_dispatch:
711

812
jobs:
913
release:
@@ -17,6 +21,12 @@ jobs:
1721
steps:
1822
- name: Checkout Repo
1923
uses: actions/checkout@v3
24+
with:
25+
# Use a PAT (falls back to GITHUB_TOKEN if unset) so the changesets
26+
# "Release PR" commits are attributed to a real token. Pushes made with
27+
# the default GITHUB_TOKEN do NOT trigger downstream workflow runs, which
28+
# is why merging the Release PR previously never ran the publish step.
29+
token: ${{ secrets.RELEASE_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
2030

2131
- name: Install pnpm
2232
uses: pnpm/action-setup@v4
@@ -38,7 +48,7 @@ jobs:
3848
id: changesets
3949
uses: changesets/action@v1
4050
env:
41-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
4252
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
4353
with:
4454
title: "🚀 Release PR"

0 commit comments

Comments
 (0)