Skip to content

Commit 339a447

Browse files
authored
internal(fix): Gate GitHub releases on hasChangesets instead of published (#3816)
`published == 'true'` is never satisfied because changesets/action cannot detect publications from the custom `yarn workspaces foreach` publish command. Use `hasChangesets == 'false'` which reliably indicates the Version Packages PR was merged and publish executed. Made-with: Cursor
1 parent 85c9ce3 commit 339a447

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.github/workflows/release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@ jobs:
3737
env:
3838
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3939

40+
# hasChangesets is 'false' after the Version Packages PR is merged (no
41+
# changeset files remain), which is the same run where publish executes.
42+
# We can't use `published == 'true'` because the custom yarn publish
43+
# command isn't detectable by changesets/action.
4044
- name: Create GitHub Releases
45+
if: steps.changesets.outputs.hasChangesets == 'false'
4146
run: node scripts/create-github-releases.mjs
4247
env:
4348
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

scripts/create-github-releases.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
/**
33
* Creates GitHub releases for published packages.
44
* Scans all packages, checks if a release already exists for the current version,
5-
* and creates one if not. Safe to run on every push (idempotent).
5+
* and creates one if not. Gated in CI by `hasChangesets == 'false'` so it only
6+
* runs after the Version Packages PR is merged and publish executes.
67
*/
78
import { execSync } from 'child_process';
89
import { readdirSync, readFileSync, existsSync } from 'fs';

0 commit comments

Comments
 (0)