fix(release): pin npmjs.org registry in publishConfig so changeset detection works#43
Merged
Merged
Conversation
…tection works
After the pnpm 10 fix unblocked OIDC publishing, the Release job still
exits non-zero: `changeset publish` reports both @prosdevlab/dev-agent and
@prosdevlab/kero as "has not been published on npm" and tries to publish
them, then npm rejects the already-published versions ("cannot publish over
the previously published versions").
Root cause: changesets' pre-publish check runs `npm info <pkg>` whose
registry comes from getCorrectRegistry() — which resolves the scoped
registry from `publishConfig["@prosdevlab:registry"]` OR the ambient
`npm_config_@prosdevlab:registry` env var. In CI that env var points the
@prosdevlab scope at GitHub Packages, where these packages don't exist, so
`npm info` 404s and changesets assumes they're unpublished. Meanwhile OIDC
trusted publishing forces the actual publish to npmjs.org, which then
correctly refuses the existing versions. Net: every no-op release is red.
Fix: set the scoped registry in each published package's publishConfig.
getCorrectRegistry reads publishConfig before the env var (`?.[] || env`),
so this deterministically points `npm info` (and publish) at npmjs.org —
changesets sees the real published versions and skips them. Verified by
simulating getCorrectRegistry against the installed @changesets/cli source:
with the GitHub-Packages env var set, publishConfig still resolves to
https://registry.npmjs.org/.
Registry URLs only; no secrets. publishConfig applies at publish time and
does not affect package consumers.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
After #42 fixed the pnpm/OIDC
--git-checkserror, the Release job still exits non-zero.changeset publishnow reports both published packages as unpublished and retries them:Both packages are on npmjs.org (
dev-agenthas 16 versions,kero@1.0.0since 2026-03-29), so this is a false "unpublished" detection — every no-op release goes red.Root cause
changesets' pre-publish check runs
npm info <pkg>, whose registry comes fromgetCorrectRegistry()(@changesets/clichangesets-cli.cjs.js:723):In CI the ambient
npm_config_@prosdevlab:registrypoints the@prosdevlabscope at GitHub Packages, where these packages don't exist →npm info404s → changesets assumes "not published" and tries to publish. Meanwhile OIDC trusted publishing forces the actual publish to npmjs.org, which then correctly refuses the already-published versions. That mismatch is the whole failure.Fix
Set the scoped registry in each published package's
publishConfig. BecausegetCorrectRegistryreadspublishConfig[...]before the env var, this deterministically pointsnpm info(and publish) at npmjs.org, so changesets sees the real versions and skips already-published packages.Applied to both published packages:
@prosdevlab/dev-agentand@prosdevlab/kero.A project
.npmrcwould not work here — an env var outranks project config in npm precedence; onlypublishConfigoverrides the ambient scoped-registry env var in this code path.Verification
Simulated
getCorrectRegistryagainst the installed@changesets/clisource with the GitHub-Packages env var set —publishConfigstill resolves tohttps://registry.npmjs.org/for both packages. Typecheck passes. Registry URLs only (no secrets);publishConfigapplies at publish time and does not affect package consumers.Expected result after merge
On the next
mainpush,changeset publishqueries npmjs.org, seesdev-agent@0.13.0andkero@1.0.0already published, publishes nothing, and the Release job goes green.🤖 Generated with Claude Code