ci: stop publishing component snaps to npm on PR builds - #10617
Conversation
The bit_pr job published a snap-tagged version of every changed component to registry.npmjs.org on every push. All open PRs share one npm token, so the job kept failing with "429 Too Many Requests - PUT https://registry.npmjs.org/...". A PR build only validates the pipeline; the packages are published for real on the export to main, so pass --skip-tasks PublishComponents. Every other task still runs. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
PR Summary by QodoCI: skip npm snap publishing on PR builds
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
Code Review by Qodo
1. PR job keeps publish token
|
| # deterministically from the second push onward. The temp-lane flow rebuilds every run | ||
| # from one commit, trading the lane's persistent history on Bit Cloud for correctness. | ||
| command: 'cd bit && bit ci pr --build --skip-cleanup' | ||
| command: 'cd bit && bit ci pr --build --skip-cleanup --skip-tasks PublishComponents' |
There was a problem hiding this comment.
1. Pr job keeps publish token 🐞 Bug ⛨ Security
bit_pr now always skips PublishComponents, but it still writes an npmjs auth token (explicitly labeled as having publishing permission) into ~/.npmrc, even though the publish task won’t run. If PR builds don’t otherwise require authenticated npm access, this keeps an unnecessarily powerful secret in the job and increases exposure risk.
Agent Prompt
### Issue description
`bit_pr` now runs `bit ci pr ... --skip-tasks PublishComponents`, but still configures an npmjs token with publishing permission in `~/.npmrc`. Since `PublishComponents` is the npm publish task, PR builds may no longer need a publish-capable token.
### Issue Context
- This PR intentionally stops publishing snaps to npm on PR builds.
- The CircleCI job still injects an npm auth token.
### Fix Focus Areas
- Verify whether `bit ci pr --build` (with PublishComponents skipped) requires authenticated npm access for anything else. If not, remove the token setup step from `bit_pr`.
- If authenticated npm access is still required for reads, replace the token with a least-privilege/read-only token and/or scope it to only the registries needed.
#### Code references
- .circleci/config.yml[849-870]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| # deterministically from the second push onward. The temp-lane flow rebuilds every run | ||
| # from one commit, trading the lane's persistent history on Bit Cloud for correctness. | ||
| command: 'cd bit && bit ci pr --build --skip-cleanup' | ||
| command: 'cd bit && bit ci pr --build --skip-cleanup --skip-tasks PublishComponents' |
There was a problem hiding this comment.
2. Publish failures deferred to master 🐞 Bug ☼ Reliability
Because bit_pr now always skips PublishComponents, PR CI no longer executes the npm publish path, so failures specific to publishing will be detected later (e.g., when bit ci merge tags on main) rather than during PR validation. This reduces pre-merge signal for changes that affect publishing behavior.
Agent Prompt
### Issue description
PR CI no longer runs the publish task, so publish-specific regressions can slip past PR validation and surface only on the main-branch merge workflow.
### Issue Context
- The change is intentional to avoid npm rate limiting.
- Still, it may be useful to have an opt-in way to validate publishing when the publish pipeline itself is being modified.
### Fix Focus Areas
- Add a separate, opt-in workflow/job that runs publishing validation (e.g., manual approval job, scheduled job, or a guarded parameter) so publish-path changes can be tested without publishing on every PR push.
#### Code references
- .circleci/config.yml[1482-1544]
- .circleci/config.yml[846-871]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Problem
bit_prhas been failing repeatedly with:The job runs the full pipeline, which includes
PublishComponents. That means every push to any open PR publishes asnap-tagged version of every changed component to registry.npmjs.org. All PRs share one npm token, so the token gets rate-limited.@teambit/multi-testeralone received 14 snap publishes over the last two days.Fix
Pass
--skip-tasks PublishComponentstobit ci prin thebit_prjob. A PR build exists to validate the pipeline — it doesn't need the snap versions on npmjs, and the packages are published for real on the export to main (bit_mergeis untouched). Every other task still runs.Notes
The alternative of dropping the
teambit.pkg/pkgconfig fromworkspace.jsoncwas considered and rejected:packageJson.name: "@teambit/{name}"is what gives the core aspects their short package names. Removing it would rename the 134@teambit/*packages that the released@teambit/bitdepends on, and break everyfrom '@teambit/<aspect>'import in this repo.The
setting npmjs registry with publishing permissionstep is left in place inbit_pr— harmless, and worth removing separately if we want PR containers to stop carrying a publish token.🤖 Generated with Claude Code