Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughA new GitHub Actions workflow Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as Developer (push tag)
participant GH as GitHub Actions
participant Repo as Repository
participant Node as Node.js runner
participant NPM as npm Registry
participant GHCLI as GitHub (gh) API
Dev->>GH: push tag (vX.Y.Z)
GH->>Repo: checkout code
GH->>Node: setup Node 22, npm cache
Node->>Repo: run npm ci, npm run lint, npm test
alt tests pass
GH->>Repo: checkout again (publish job)
GH->>Node: setup Node 22 with registry auth
Node->>Repo: read package.json version
Node->>GH: compare tag (strip leading v) with package.json
alt versions match
Node->>NPM: npm publish --provenance --access public (NODE_AUTH_TOKEN)
Node->>GHCLI: gh release create --generate-notes
else versions differ
Node-->>GH: fail job (version mismatch)
end
else tests fail
Node-->>GH: fail publish
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Pull request overview
Adds a tag-triggered GitHub Actions workflow to publish the package to npm and create a GitHub Release, ensuring CI passes and the git tag matches package.json before publishing.
Changes:
- Introduces
.github/workflows/publish.ymltriggered onv*tags. - Runs
npm ci, lint, and tests prior to publishing. - Verifies tag version matches
package.json, then publishes to npm (with provenance) and creates a GitHub release with generated notes.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/workflows/publish.yml (1)
47-51: Consider:gh release createwill fail if a release already exists for the tag.This is likely acceptable behavior for your use case (preventing duplicate releases), but if you want idempotency for re-runs, you could add
|| trueor check for existing releases first. Not critical—just noting for awareness.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/publish.yml around lines 47 - 51, The "Create GitHub release" step runs gh release create "$TAG_REF" --generate-notes which will fail if a release for TAG_REF already exists; make the step idempotent by either appending a no-op on failure (e.g., add "|| true") or by first checking for an existing release with gh release view "$TAG_REF" and only calling gh release create when that check fails so the workflow won't error on re-runs; update the step that sets GH_TOKEN and TAG_REF and the command invocation accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.github/workflows/publish.yml:
- Around line 47-51: The "Create GitHub release" step runs gh release create
"$TAG_REF" --generate-notes which will fail if a release for TAG_REF already
exists; make the step idempotent by either appending a no-op on failure (e.g.,
add "|| true") or by first checking for an existing release with gh release view
"$TAG_REF" and only calling gh release create when that check fails so the
workflow won't error on re-runs; update the step that sets GH_TOKEN and TAG_REF
and the command invocation accordingly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 61404219-7b75-420d-9900-5e75ddf829b7
📒 Files selected for processing (1)
.github/workflows/publish.yml
Triggers on v* tags. Runs lint + test, verifies tag matches package.json version, publishes to npm with provenance, and creates a GitHub release with auto-generated notes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
4c3b297 to
237c429
Compare
Summary
publish.ymlworkflow triggered onv*tagsNPM_TOKENsecret to be set in repo settingsAlso done (outside this PR)
lint-testCI must pass, no force pushesSetup needed
Add
NPM_TOKENas a repository secret: Settings > Secrets and variables > Actions > New repository secretTest plan
Summary by CodeRabbit