Skip to content

feat(ci): add pkg.pr.new canary releases - #874

Merged
ravisuhag merged 6 commits into
mainfrom
feat/canary-release
Aug 1, 2026
Merged

feat(ci): add pkg.pr.new canary releases#874
ravisuhag merged 6 commits into
mainfrom
feat/canary-release

Conversation

@ravisuhag

Copy link
Copy Markdown
Member

Summary

  • Add .github/workflows/canary.yaml to publish a preview build of @raystack/apsara to pkg.pr.new on every PR and push to main, so changes can be installed and tested before a real npm release
  • Document the canary workflow in CONTRIBUTING.md
  • Add a "Try a preview build" section to the Getting Started docs

Test plan

  • Merge and confirm the workflow runs on the next PR
  • Confirm pkg.pr.new comments on the PR with an install link
  • Install the preview build in a test project and verify it works

Publishes a preview build of @raystack/apsara to pkg.pr.new on every
PR and push to main, so changes can be installed and tested before a
real npm release. Document the workflow in CONTRIBUTING.md and add
install instructions to the getting-started docs.
@vercel

vercel Bot commented Aug 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
apsara Ready Ready Preview Aug 1, 2026 7:30am

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 20de9f88-169c-4992-acd4-89e7df9d7567

📥 Commits

Reviewing files that changed from the base of the PR and between b00f165 and ab1715d.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (6)
  • .github/workflows/canary.yaml
  • CONTRIBUTING.md
  • apps/www/src/content/docs/(overview)/getting-started.mdx
  • package.json
  • packages/raystack/README.md
  • packages/raystack/package.json
🚧 Files skipped from review as they are similar to previous changes (2)
  • CONTRIBUTING.md
  • apps/www/src/content/docs/(overview)/getting-started.mdx

📝 Walkthrough

Walkthrough

The PR adds a GitHub Actions canary workflow for pull requests and pushes to main. The workflow configures pnpm 9 and Node.js 22, installs frozen dependencies, builds Apsara, and publishes the Raystack package through pkg.pr.new. Contributor and getting-started documentation explain preview builds, installation commands, and update behavior.

Sequence Diagram(s)

sequenceDiagram
  participant GitHubActions as GitHub Actions
  participant NodePnpm as pnpm and Node.js
  participant Apsara
  participant PkgPrNew as pkg.pr.new
  GitHubActions->>NodePnpm: Configure Node.js 22 and pnpm 9
  NodePnpm->>Apsara: Install frozen dependencies
  Apsara->>Apsara: Build Apsara
  Apsara->>PkgPrNew: Publish preview package
Loading

Suggested reviewers: rohanchkrabrty

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: adding pkg.pr.new canary releases through CI.
Description check ✅ Passed The description accurately summarizes the workflow, documentation updates, and planned validation steps.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

pnpm exec requires the binary to be installed, unlike npx/dlx. The
canary workflow was failing with "Command pkg-pr-new not found".
@pkg-pr-new

pkg-pr-new Bot commented Aug 1, 2026

Copy link
Copy Markdown

Open in StackBlitz

pnpm add https://pkg.pr.new/raystack/apsara/@raystack/apsara@874

commit: ab1715d

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (4)
.github/workflows/canary.yaml (3)

20-21: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Disable checkout credential persistence.

Pull-request runs execute code from the pull request. actions/checkout@v4 persists GITHUB_TOKEN for later steps unless persist-credentials: false is set. permissions: {} limits the token, but opting out removes the credential from the workspace and protects against future permission changes. (github.com)

Proposed fix
       - name: Checkout 🛎️
         uses: actions/checkout@v4
+        with:
+          persist-credentials: false
🤖 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/canary.yaml around lines 20 - 21, Update the
actions/checkout@v4 step in the canary workflow to set persist-credentials to
false, ensuring checkout does not retain GITHUB_TOKEN credentials for subsequent
steps while preserving the existing checkout behavior.

Source: Linters/SAST tools


41-41: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Use a unique preview version.

@raystack/apsara currently declares version 0.48.0. pkg.pr.new keeps the source version by default and documents possible collisions with later npm releases and lockfiles. Add --previewVersion so preview installs use a distinct version. (github.com)

Proposed fix
-        run: pnpm exec pkg-pr-new publish ./packages/raystack --comment=update
+        run: pnpm exec pkg-pr-new publish ./packages/raystack --previewVersion --comment=update
🤖 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/canary.yaml at line 41, Update the pkg-pr-new publish
command in the canary workflow to include the --previewVersion option, ensuring
generated preview packages use a unique version while preserving the existing
package path and --comment=update behavior.

14-18: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Cancel stale preview runs.

Multiple runs can execute concurrently for rapid pushes. Because --comment=update edits an existing preview comment, an older run can finish after a newer run and leave stale publish information in that comment. Add a concurrency group keyed by pull request number or ref. GitHub Actions permits concurrent runs by default and supports cancel-in-progress for this case. (docs.github.com)

Proposed fix
 permissions: {}
+
+concurrency:
+  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+  cancel-in-progress: true
🤖 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/canary.yaml around lines 14 - 18, Add a GitHub Actions
concurrency configuration to the workflow, keyed by the pull request number or
ref, with cancel-in-progress enabled so newer publish jobs supersede stale runs.
Keep the existing publish job settings unchanged.
CONTRIBUTING.md (1)

278-289: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Document the installation path for main previews.

The workflow also publishes on direct pushes to main, but this section only provides a pull-request comment command. A direct main push may not have a pull request comment. Add a main preview link or a link to the repository's pkg.pr.new page, and state which URL users should install. pkg.pr.new documents branch tags for in-repository branches. (github.com)

🤖 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 `@CONTRIBUTING.md` around lines 278 - 289, Update the “Canary Releases” section
to document how to install previews published from direct pushes to main,
including the repository’s pkg.pr.new main/branch preview URL and the exact URL
users should install when no pull-request comment is available. Preserve the
existing pull-request installation guidance.
🤖 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/canary.yaml:
- Line 41: Update the pkg-pr-new publish step in the canary workflow to publish
the built packages/raystack artifact rather than the workspace source. Ensure
this step runs after the build step so generated outputs are available, while
preserving the existing preview comment behavior.
- Around line 7-8: Update the canary workflow’s pull_request trigger to run for
pull requests targeting any branch by removing the branches filter. Preserve the
existing canary preview behavior and keep the documentation’s claim that every
pull request receives a preview build accurate.

In `@CONTRIBUTING.md`:
- Around line 284-286: Update both preview installation snippets in
CONTRIBUTING.md to use the composite repository’s resolved metadata rather than
`@raystack/apsara`’s package metadata, or replace them with full pkg.pr.new URLs.
Ensure both documented commands remain valid for installing the preview package.

---

Nitpick comments:
In @.github/workflows/canary.yaml:
- Around line 20-21: Update the actions/checkout@v4 step in the canary workflow
to set persist-credentials to false, ensuring checkout does not retain
GITHUB_TOKEN credentials for subsequent steps while preserving the existing
checkout behavior.
- Line 41: Update the pkg-pr-new publish command in the canary workflow to
include the --previewVersion option, ensuring generated preview packages use a
unique version while preserving the existing package path and --comment=update
behavior.
- Around line 14-18: Add a GitHub Actions concurrency configuration to the
workflow, keyed by the pull request number or ref, with cancel-in-progress
enabled so newer publish jobs supersede stale runs. Keep the existing publish
job settings unchanged.

In `@CONTRIBUTING.md`:
- Around line 278-289: Update the “Canary Releases” section to document how to
install previews published from direct pushes to main, including the
repository’s pkg.pr.new main/branch preview URL and the exact URL users should
install when no pull-request comment is available. Preserve the existing
pull-request installation guidance.
🪄 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 Plus

Run ID: c89899a8-f8f9-4576-8523-28029b86c7c1

📥 Commits

Reviewing files that changed from the base of the PR and between 5a388ac and b00f165.

📒 Files selected for processing (3)
  • .github/workflows/canary.yaml
  • CONTRIBUTING.md
  • apps/www/src/content/docs/(overview)/getting-started.mdx

Comment thread .github/workflows/canary.yaml Outdated
Comment thread .github/workflows/canary.yaml Outdated
run: pnpm build:apsara

- name: Publish 🚀
run: pnpm exec pkg-pr-new publish ./packages/raystack --comment=update

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== workflow line =="
cat -n .github/workflows/canary.yaml | sed -n '35,45p'

echo
echo "== pkg.pr.new related docs/config =="
rg -n "pkg\.pr\.new|pkg-pr-new|--commentWithSha|--packageManager|commentWithSha|packageManager" -S .github README.md packages 2>/dev/null || true

echo
echo "== package manager/package info =="
for f in package.json pnpm-workspace.yaml pnpm-lock.yaml; do
  if [ -f "$f" ]; then
    echo "--- $f ---"
    sed -n '1,120p' "$f"
  fi
done

Repository: raystack/apsara

Length of output: 6132


🌐 Web query:

pkg.pr.new packageManager commentWithSha npm install snippets PR-number URLs defaults

💡 Result:

pkg.pr.new is a tool for creating continuous, npm-compatible preview releases directly from your GitHub pull requests and commits without publishing to the npm registry [1][2]. Below are the details regarding the configuration flags you inquired about: --commentWithSha This flag controls the format of the installation URLs generated in the GitHub comments posted by the bot [3]. - When set to true, the bot uses the commit SHA instead of the pull request number in the generated install commands (e.g., npm i https://pkg.pr.new/package@a832a55) [3]. - When set to false (default), it uses the pull request number (e.g., npm i https://pkg.pr.new/package@123), which can sometimes lead to caching issues because the URL remains the same for different commits within the same PR [4][3]. --packageManager=XYZ This flag allows you to customize the package manager syntax reflected in the bot's comments [1][3]. - Supported values for XYZ are: npm (default), pnpm, yarn, or bun [1][5]. - You can provide multiple comma-separated values (e.g., --packageManager=npm,pnpm) to show snippets for different package managers simultaneously [1][2]. Additional Context: - Usage: These flags are typically passed to the pkg-pr-new command in your GitHub Actions workflows (e.g., pnpm exec pkg-pr-new publish --commentWithSha --packageManager=npm,pnpm) [6][1][5]. - Defaults: By default, the tool uses npm as the package manager and includes the pull request number in the comment links [5][3]. - Other Flags: The tool also offers --bin (to show npx execute commands instead of install commands for CLI apps) and --no-compact (to force long-form URLs) [1][2][5]. For more control, you can use --comment=off in combination with the --json flag to generate metadata and create your own custom GitHub comments via the GitHub Actions API [2][7].

Citations:


Publish pkg.pr.new previews for the pnpm workspace.

pnpm exec pkg-pr-new publish ./packages/raystack publishes the workspace package source rather than a built package, which can produce install commands that do not resolve correctly. Publish packages/raystack after the build step, or use the built artifact path.

🧰 Tools
🪛 zizmor (1.28.0)

[info] 41-41: prefer trusted publishing for authentication (use-trusted-publishing): this command

(use-trusted-publishing)

🤖 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/canary.yaml at line 41, Update the pkg-pr-new publish step
in the canary workflow to publish the built packages/raystack artifact rather
than the workspace source. Ensure this step runs after the build step so
generated outputs are available, while preserving the existing preview comment
behavior.

Comment thread CONTRIBUTING.md
- Fix the documented install URL: pkg.pr.new URLs are scoped by
  <owner>/<repo>/<package>@<ref>, not just <package>@<ref>
- Document the install path for canary builds published from direct
  pushes to main, which don't have a PR to comment on
- Drop persist-credentials on checkout since the job builds and runs
  PR code
- Cancel superseded runs so a stale run can't overwrite a newer one's
  PR comment
pkg.pr.new only shortens preview URLs to <package>@<ref> when the
currently published npm version has a valid repository field —
otherwise it falls back to the long owner/repo/<package>@<ref> form.
This takes effect starting with the next npm release.
Comment thread .github/workflows/canary.yaml Outdated
run: pnpm build:apsara

- name: Publish 🚀
run: pnpm exec pkg-pr-new publish ./packages/raystack --comment=update

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use the --packageManager=pnpm flag to shown pnpm in the generated comments

Comment thread .github/workflows/canary.yaml Outdated
run: pnpm build:apsara

- name: Publish 🚀
run: pnpm exec pkg-pr-new publish ./packages/raystack --comment=update

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I think we should use --previewVersion

Use --previewVersion to rewrite every published package's version to 0.0.0-preview- before packing (working tree is restored afterward):

pnpm exec pkg-pr-new publish --previewVersion './packages/*'
For example, 1.0.0 becomes 0.0.0-preview-a832a55. The 0.0.0- prefix cannot satisfy a normal semver range for a real release, so lockfile collisions with npm versions are avoided.

From their docs^

Run canary previews for PRs targeting any branch, use --previewVersion
to avoid colliding with the real npm version, and use --packageManager=pnpm
so generated install snippets match this pnpm-only repo.
@ravisuhag
ravisuhag merged commit d860f6a into main Aug 1, 2026
7 checks passed
@ravisuhag
ravisuhag deleted the feat/canary-release branch August 1, 2026 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants