From e28d7190faae69bd4388e0e5b4840ebda156ab38 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 1 Sep 2026 15:23:32 +0000 Subject: [PATCH 1/3] Fix /release-snapshot comment reporting stale alpha version The "Get snapshot versions" step read each package's new version via `pnpm view dist-tags.alpha` immediately after `changeset publish`. npm's registry can lag a few seconds behind a publish before the new dist-tag is visible to a read, so this consistently reported the alpha version from a previous snapshot run instead of the one just published. Verified against a recent run (#433): it published gcg-typescript-resolver-files@0.0.0-pr490-run433-1-... but the comment reported 0.0.0-pr487-run427-1-... from three days earlier, even though querying the registry later returns the correct, freshly published tag. Fix: read the version straight from each package's local package.json when it was actually published this run (its version already matches the run's snapshot tag prefix, written by `changeset version --snapshot`) instead of round-tripping through the registry. Packages untouched by the PR's changesets (not published this run) still fall back to `pnpm view` to report their current alpha tag. --- .github/workflows/release.yml | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 02567a19..78045fd4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -116,20 +116,39 @@ jobs: - name: Get snapshot versions id: get_snapshot_versions run: | + # pkg name -> local package dir PACKAGES=( - "@eddeee888/gcg-operation-location-migration" - "@eddeee888/gcg-server-config" - "@eddeee888/gcg-typescript-resolver-files" + "@eddeee888/gcg-operation-location-migration:packages/operation-location-migration" + "@eddeee888/gcg-server-config:packages/server-config" + "@eddeee888/gcg-typescript-resolver-files:packages/typescript-resolver-files" ) echo "versions<> $GITHUB_OUTPUT - for pkg in "${PACKAGES[@]}"; do - version=$(pnpm view "$pkg" dist-tags.alpha) + for entry in "${PACKAGES[@]}"; do + pkg="${entry%%:*}" + dir="${entry##*:}" + local_version=$(node -p "require('./$dir/package.json').version") + + if [[ "$local_version" == 0.0.0-"$RELEASE_TAG"-* ]]; then + # Published in this run: `changeset version --snapshot` already wrote this + # exact version to package.json, so use it directly instead of asking the + # registry - `pnpm view`/npm's dist-tags read can lag a few seconds behind + # a publish and return the previous alpha version instead of the one we + # just published. + version="$local_version" + else + # Not touched by this PR's changesets, so nothing new was published for it + # this run - report whatever is currently tagged alpha. + version=$(pnpm view "$pkg" dist-tags.alpha) + fi + echo "" >> $GITHUB_OUTPUT echo "$pkg@$version" >> $GITHUB_OUTPUT done echo "" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT + env: + RELEASE_TAG: ${{ env.snapshot-release-tag }} - name: Report success if: success() From bfe6ea2a733cb58230c872f6230a68722090feb8 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 1 Sep 2026 15:30:16 +0000 Subject: [PATCH 2/3] Add inline comments explaining pkg/dir split Clarify what the %% and ## parameter expansions do when splitting each "pkg:dir" entry. --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 78045fd4..d9e07766 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -125,8 +125,8 @@ jobs: echo "versions<> $GITHUB_OUTPUT for entry in "${PACKAGES[@]}"; do - pkg="${entry%%:*}" - dir="${entry##*:}" + pkg="${entry%%:*}" # part before the first ":" + dir="${entry##*:}" # part after the last ":" local_version=$(node -p "require('./$dir/package.json').version") if [[ "$local_version" == 0.0.0-"$RELEASE_TAG"-* ]]; then From 61e33a159d570f8917ea12db42436537c649a11d Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 1 Sep 2026 15:31:55 +0000 Subject: [PATCH 3/3] Skip packages with no changeset in the /release-snapshot comment Previously, packages not touched by the PR's changesets still got a line in the comment via a `pnpm view` fallback, showing a stale version from an unrelated prior run. Now they're left out of the comment entirely instead. --- .github/workflows/release.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d9e07766..942f6340 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -129,19 +129,19 @@ jobs: dir="${entry##*:}" # part after the last ":" local_version=$(node -p "require('./$dir/package.json').version") - if [[ "$local_version" == 0.0.0-"$RELEASE_TAG"-* ]]; then - # Published in this run: `changeset version --snapshot` already wrote this - # exact version to package.json, so use it directly instead of asking the - # registry - `pnpm view`/npm's dist-tags read can lag a few seconds behind - # a publish and return the previous alpha version instead of the one we - # just published. - version="$local_version" - else - # Not touched by this PR's changesets, so nothing new was published for it - # this run - report whatever is currently tagged alpha. - version=$(pnpm view "$pkg" dist-tags.alpha) + if [[ "$local_version" != 0.0.0-"$RELEASE_TAG"-* ]]; then + # Not touched by this PR's changesets, so nothing was published for it + # this run - leave it out of the comment entirely. + continue fi + # Published in this run: `changeset version --snapshot` already wrote this + # exact version to package.json, so use it directly instead of asking the + # registry - `pnpm view`/npm's dist-tags read can lag a few seconds behind + # a publish and return the previous alpha version instead of the one we + # just published. + version="$local_version" + echo "" >> $GITHUB_OUTPUT echo "$pkg@$version" >> $GITHUB_OUTPUT done