chore(github): add pkg.pr.new preview publishing#495
Conversation
Publish preview packages on each CI run so PRs get installable @nuxt/icon builds without an npm release.
commit: |
📝 WalkthroughWalkthroughThis PR updates .github/workflows/ci.yml by adding a Publish step immediately after the Test step. The step runs: pnpx pkg-pr-new publish --compact --no-template --pnpm and the added snippet does not include an Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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.
Actionable comments posted: 2
🧹 Nitpick comments (1)
.github/workflows/ci.yml (1)
52-53: ⚡ Quick winConsider adding graceful failure handling for missing app installation.
The PR description states "Merge after installing the pkg.pr.new app," but there's no safeguard if the app isn't installed. Currently, the publish step will fail and block the entire CI pipeline. Consider adding
continue-on-error: trueso CI can complete even if publishing fails, or add a conditional check.♻️ Option 1: Allow CI to pass if publish fails
- name: Publish + continue-on-error: true run: pnpx pkg-pr-new publish --compact --no-template --pnpmThis ensures build/test failures are caught while allowing publish issues to not block CI.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/ci.yml around lines 52 - 53, The Publish step currently runs "pnpx pkg-pr-new publish --compact --no-template --pnpm" with no safeguard; update the CI step labeled "Publish" to handle a missing pkg.pr.new app by either adding continue-on-error: true to the step or wrapping the publish invocation in a conditional that checks for the app/credentials before running (e.g., detect an env var or output from a prior check) so the pipeline won’t fail if the app isn’t installed.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/ci.yml:
- Around line 52-53: The Publish step currently runs for all pull_request events
including forks; add an if-condition on the Publish step to only run on pushes
to main or pull requests from the same repository. Modify the step with name
"Publish" to include an if expression such as: if: (github.event_name == 'push'
&& startsWith(github.ref, 'refs/heads/main')) || (github.event_name ==
'pull_request' && github.event.pull_request.head.repo.full_name ==
github.repository') so the pnpx pkg-pr-new publish command only executes in
those trusted contexts.
- Around line 52-53: Add explicit GitHub Actions permissions required by
pkg.pr.new to avoid OIDC/auth failures: at the workflow or the job that contains
the "Publish" step (the step running "pnpx pkg-pr-new publish --compact
--no-template --pnpm"), add permissions including id-token: write,
pull-requests: write, and contents: read so pkg.pr.new can perform OIDC auth,
post installation comments, and read repo contents.
---
Nitpick comments:
In @.github/workflows/ci.yml:
- Around line 52-53: The Publish step currently runs "pnpx pkg-pr-new publish
--compact --no-template --pnpm" with no safeguard; update the CI step labeled
"Publish" to handle a missing pkg.pr.new app by either adding continue-on-error:
true to the step or wrapping the publish invocation in a conditional that checks
for the app/credentials before running (e.g., detect an env var or output from a
prior check) so the pipeline won’t fail if the app isn’t installed.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5ec6331b-555d-41fe-b061-ba2cf9c0e3aa
📒 Files selected for processing (1)
.github/workflows/ci.yml
Skip publish on fork PRs and declare OIDC/PR permissions for pkg-pr-new. ci: drop unneeded permissions block for pkg.pr.new pkg.pr.new works through its GitHub App, so the workflow token scopes weren't required. Keeps the fork guard. ci: drop fork guard to match other nuxt modules Keeps the pkg.pr.new step consistent with @nuxt/ui and @nuxt/content. ci: guard pkg.pr.new to the nuxt org Matches nuxt/nuxt: skip preview publish on fork PRs.
f18f94a to
a8b084f
Compare
Summary
pkg-pr-new publishstep to CI after build and tests--compact --no-template --pnpmto match other Nuxt modulesMotivation
Enables continuous preview releases on PRs and pushes to
main, so consumers can install@nuxt/iconfrompkg.pr.newwithout waiting for an npm publish.Setup
The pkg.pr.new GitHub App must be installed on this repository before the publish step succeeds.
Test plan
pnpm add https://pkg.pr.new/@nuxt/icon@<sha>installs the built module