ci: auto-publish to npm when commits land on master - #6
Conversation
Add a release job to main.yml, gated on the full test matrix (needs:
[test]). It mirrors the tinyspawn release flow, adapted for the lerna
monorepo:
- checks out master with full history + GITHUB_TOKEN so lerna can push
the changelog commit and version tags
- writes NPM_TOKEN to user-level npm config, because pnpm now ignores
the ${NPM_TOKEN} placeholder in the committed project .npmrc
- runs the existing 'pnpm run release' (lerna publish), which only
publishes packages that have conventional-commit changes since their
last tag, so it publishes only when needed
Loop prevention: lerna's chore(release) commit is pushed via
GITHUB_TOKEN and does not re-trigger on:push; the test guard also skips
chore(release)/docs/ci commits, which skips release via the needs chain.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XZKpkLcBt4Z1t7Xronhet4
|
Warning Review limit reached
Next review available in: 17 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Address Cursor Bugbot: the release job checked out master tip and published after 'git pull', but the test matrix only validated the trigger SHA. When the contributors job (or a concurrent push) advanced master, lerna could publish code this run never tested. - release now runs 'pnpm test' on the pulled tip right before 'pnpm run release', so only just-tested code ships (matches the tinyspawn release job, which also tests before publishing) - add a concurrency group (cancel-in-progress: false) so two release jobs can't run lerna publish at once and race on tag pushes, without ever killing an in-flight publish Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XZKpkLcBt4Z1t7Xronhet4
|
Good catch, fixed in a576dce. The race was real: the Fix mirrors the tinyspawn release job: the release job now runs |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a576dce. Configure here.
Bugbot: the release Test step ran root 'pnpm test', whose 'pretest' runs the repo-wide 'standard' + 'standard-markdown' lint. The matrix test job only runs per-package tests and never runs that root lint, so CI could be green while release fails on lint alone (a publish-time-only gate that no PR check surfaced). Run 'pnpm --recursive --sequential test' instead: same per-package tests the matrix validates (function/mql still lint+build via their own pretest), without introducing the root lint as a new release-only gate. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XZKpkLcBt4Z1t7Xronhet4
|
Fixed in 32a0de1. You're right, and it was worse than a mismatch: root lint ( Changed the release re-test to |
standard (JS) and standard-markdown already live at the root and cover every package, but ran in no CI gate. The per-package 'lint' scripts were tsd (type-def tests), not JS lint, wired into each package's pretest as leftover from merging the repos together. - add a root-level 'lint' job to main.yml and pull_request.yml running 'pnpm lint' (standard + standard-markdown), so JS/markdown lint is enforced once for the whole monorepo - gate release on it: release needs [test, lint] - drop the residual per-package 'lint' scripts; fold tsd into each package's own 'test' (ava && tsd), where the type tests belong - per-package pretest now only builds what the tests need Verified: pnpm lint passes; function/mql/core tsd pass. core's ava still fails on the pre-existing flaky live-API 'video' integration test, which is unrelated to this change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XZKpkLcBt4Z1t7Xronhet4
'video detects the primary video' fails intermittently because the live API returns null video data for vimeo.com/76979871, throwing on video.url. It blocks the whole test matrix and, with release gated on tests, every publish. Skip it until the API reliably returns a video. core: 37 passed, 1 skipped. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XZKpkLcBt4Z1t7Xronhet4
Coverage Report for CI Build 29997911105Warning No base build found for commit Coverage: 76.925%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsRequires a base build to compare against. How to fix this → Coverage Stats
💛 - Coveralls |

What
Adds a
releasejob to.github/workflows/main.ymlso pushes tomasterpublish automatically, replacing the manualpnpm release. Mirrors the tinyspawn workflow, adapted for this lerna monorepo.How it works
releaseneeds: [test], so it publishes only when every package's matrix leg is green.pnpm run release(lerna publish --conventional-commits), which bumps + publishes only packages with conventional-commit changes since their last tag.\${NPM_TOKEN}line in the committed.npmrc(it refuses to expand env vars in a committed project.npmrc). The release step writes the token to user-level config viapnpm config setso publish authenticates.masterwith full history +GITHUB_TOKENso lerna can push the changelog commit and version tags.Loop prevention
lerna's
chore(release):commit is pushed withGITHUB_TOKEN, which does not re-triggeron: push. Belt-and-suspenders: thetestguard skipschore(release):/docs:/ci:commits, and a skippedtestskipsreleasethrough theneedschain.Secrets required (org-level, same as tinyspawn)
NPM_TOKEN,GH_TOKEN,GIT_EMAIL,GIT_USERNAME— the existingcontributorsjob already resolves the git ones, so they're present.Note
The
microlink.io(core) package currently has a flaky live-API integration test (video detects the primary video). Because release is gated on the full matrix, that test must be green for any package to publish. Worth stabilizing separately.🤖 Generated with Claude Code
https://claude.ai/code/session_01XZKpkLcBt4Z1t7Xronhet4
Note
Medium Risk
Release job publishes to npm and pushes version tags using secrets; incorrect gating or auth could block or mispublish, though it still depends on green test/lint and existing lerna behavior.
Overview
Adds automated npm publishing on pushes to
mastervia a newreleasejob that runs aftertestandlint, syncsmaster, re-runs the full test suite, configures npm auth withpnpm config set, and invokes the existingpnpm run release(lerna conventional publish). A workflow concurrency group (release-${{ github.ref }}, no cancel-in-progress) serializes release runs on the same ref.Introduces a dedicated
lintjob (pnpm lintat repo root) in bothmain.ymlandpull_request.yml(PR lint skipped on directmasterpushes). Package scripts fold tsd intotest(ava && tsd) and drop per-packagelint/ lint-from-pretest incore,function, andmql.Unblocks the release gate by skipping the flaky live-API
video detects the primary videointegration test inpackages/corewith a TODO to re-enable when the API is stable.Reviewed by Cursor Bugbot for commit 4b1214a. Bugbot is set up for automated code reviews on this repo. Configure here.