Tooling: Use pkg.pr.new for canary releases#34799
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds a GitHub Actions workflow that, when labeled, checks out PR head, sets up Node, builds publishable packages, publishes preview packages via ChangesPreview Package Publishing Workflow
pkg.pr.new Specifier Propagation
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Comment |
storybook
@storybook/addon-a11y
@storybook/addon-docs
@storybook/addon-links
@storybook/addon-onboarding
storybook-addon-pseudo-states
@storybook/addon-themes
@storybook/addon-vitest
@storybook/builder-vite
@storybook/builder-webpack5
@storybook/angular
@storybook/ember
@storybook/html-vite
@storybook/nextjs
@storybook/nextjs-vite
@storybook/preact-vite
@storybook/react-native-web-vite
@storybook/react-vite
@storybook/react-webpack5
@storybook/server-webpack5
@storybook/svelte-vite
@storybook/sveltekit
@storybook/tanstack-react
@storybook/vue3-vite
@storybook/web-components-vite
sb
@storybook/cli
@storybook/codemod
@storybook/core-webpack
create-storybook
@storybook/csf-plugin
eslint-plugin-storybook
@storybook/react-dom-shim
@storybook/preset-create-react-app
@storybook/preset-react-webpack
@storybook/preset-server-webpack
@storybook/html
@storybook/preact
@storybook/react
@storybook/server
@storybook/svelte
@storybook/vue3
@storybook/web-components
commit: |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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/publish-preview.yml:
- Line 6: The workflow currently retriggers on any label addition because it
checks all PR labels; change the labeled-event gating to inspect only the newly
added label (github.event.label.name) instead of the full labels array. Update
the trigger/conditional that currently references pull_request.labels (or
similar) to use a condition like checking github.event.action == 'labeled' &&
contains(['ci:normal','ci:merged','ci:daily'], github.event.label.name) so the
job runs only when the new label is one of the eligible ci labels.
- Around line 106-128: Give the "Replace Pull Request Body" step an id (e.g.,
id: replace-pr-body) and change the conditional on the "Create failing comment
on PR" step to only run when the job failed for reasons other than the PR-body
update (for example: if: ${{ failure() && steps.replace-pr-body.outcome !=
'failure' }}), and update the gh pr comment body text to say it failed to
publish preview packages or update the PR body (so it covers both failure
modes); reference the step names "Replace Pull Request Body" (id:
replace-pr-body) and "Create failing comment on PR" when making these edits.
- Around line 47-53: Replace the weak "non-empty file" check for
pkg-pr-new-output.json with a structural jq validation that fails the step
unless the JSON has a non-empty .packages array and each package object contains
the fields used later when generating the PR body (e.g., "name" and "version" —
whatever keys lines that extract values expect); use jq's exit-on-false behavior
(jq -e) so the workflow step exits non‑zero on validation failure, ensuring you
only proceed when pkg-pr-new-output.json has the required structure.
🪄 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: 7e030b12-0d00-4e25-85ca-8e1312ac5d1e
📒 Files selected for processing (1)
.github/workflows/publish-preview.yml
|
Failed to publish preview packages for this pull request, triggered by @JReinhold. See the failed workflow run at: https://github.com/storybookjs/storybook/actions/runs/25853849266 |
|
Failed to publish preview packages for this pull request, triggered by @JReinhold. See the failed workflow run at: https://github.com/storybookjs/storybook/actions/runs/26122477222 |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 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/publish-preview.yml:
- Around line 32-35: Update the "Checkout pull request HEAD" step that currently
uses actions/checkout@v4 to pin the action to a specific full commit SHA
(replace actions/checkout@v4 with the exact commit SHA for the checkout action)
and add the checkout input persist-credentials: false under the with: block
(next to ref: ${{ github.event.pull_request.head.sha }}) so credentials are not
carried forward to later steps.
In `@code/lib/cli-storybook/package.json`:
- Line 59: Move the "process-ancestry" entry out of devDependencies and into
runtime dependencies in package.json so it's available when the CLI is
installed; specifically remove "process-ancestry": "^0.0.2" from devDependencies
and add the same key/version under "dependencies". Also verify imports in
upgrade.ts still resolve (no code changes needed there) and run a local
pack/install to ensure no ERR_MODULE_NOT_FOUND at runtime.
In `@code/lib/cli-storybook/src/upgrade.ts`:
- Line 84: The use of toReversed() on getProcessAncestry() is Node‑20+ only and
can throw on older Node versions; replace that call with a compatibility-safe
reversal such as converting the iterable to an array and calling reverse (e.g.,
[...getProcessAncestry()].reverse()) or iterate the array backwards with an
index-based loop; update the for loop that currently reads for (const ancestor
of getProcessAncestry().toReversed()) to use the array-reverse approach (or
manual reverse iteration) so it works on Node 18 and earlier.
In `@code/lib/create-storybook/src/commands/PreflightCheckCommand.ts`:
- Around line 41-43: The code in PreflightCheckCommand is unconditionally
overwriting options.storybookVersionSpecifier with
versionService.getStorybookVersionFromAncestry(getProcessAncestry()); change the
logic so you only set options.storybookVersionSpecifier from
getStorybookVersionFromAncestry when it is not already provided by the caller
(i.e., if options.storybookVersionSpecifier is falsy/undefined). Locate the
assignment in PreflightCheckCommand and guard it with a check against the
existing options.storybookVersionSpecifier so callers' explicit specifiers are
preserved.
🪄 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: 60bdfd49-8f2f-4150-ac0f-001ce3f80040
📒 Files selected for processing (15)
.github/workflows/publish-preview.ymlcode/core/src/common/index.tscode/core/src/common/js-package-manager/JsPackageManager.test.tscode/core/src/common/js-package-manager/JsPackageManager.tscode/core/src/common/utils/get-pkg-pr-new-package-specifier.tscode/lib/cli-storybook/package.jsoncode/lib/cli-storybook/src/upgrade.test.tscode/lib/cli-storybook/src/upgrade.tscode/lib/cli-storybook/src/util.tscode/lib/create-storybook/src/commands/GeneratorExecutionCommand.tscode/lib/create-storybook/src/commands/PreflightCheckCommand.tscode/lib/create-storybook/src/generators/REACT_NATIVE/index.tscode/lib/create-storybook/src/generators/baseGenerator.tscode/lib/create-storybook/src/generators/types.tscode/lib/create-storybook/src/services/VersionService.test.ts
✅ Files skipped from review due to trivial changes (1)
- code/lib/create-storybook/src/generators/REACT_NATIVE/index.ts
| try { | ||
| options.storybookVersionSpecifier = | ||
| this.versionService.getStorybookVersionFromAncestry(getProcessAncestry()); |
There was a problem hiding this comment.
Preserve explicit storybookVersionSpecifier instead of always overriding it.
Line 42 currently overwrites any user-provided version specifier. That can force an unintended version/source when callers explicitly set one.
Suggested fix
- try {
- options.storybookVersionSpecifier =
- this.versionService.getStorybookVersionFromAncestry(getProcessAncestry());
+ try {
+ if (options.storybookVersionSpecifier === undefined) {
+ options.storybookVersionSpecifier =
+ this.versionService.getStorybookVersionFromAncestry(getProcessAncestry());
+ }
} catch {
// Ignore ancestry lookup failures and fall back to the embedded release versions.
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| try { | |
| options.storybookVersionSpecifier = | |
| this.versionService.getStorybookVersionFromAncestry(getProcessAncestry()); | |
| try { | |
| if (options.storybookVersionSpecifier === undefined) { | |
| options.storybookVersionSpecifier = | |
| this.versionService.getStorybookVersionFromAncestry(getProcessAncestry()); | |
| } | |
| } catch { | |
| // Ignore ancestry lookup failures and fall back to the embedded release versions. | |
| } |
🤖 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 `@code/lib/create-storybook/src/commands/PreflightCheckCommand.ts` around lines
41 - 43, The code in PreflightCheckCommand is unconditionally overwriting
options.storybookVersionSpecifier with
versionService.getStorybookVersionFromAncestry(getProcessAncestry()); change the
logic so you only set options.storybookVersionSpecifier from
getStorybookVersionFromAncestry when it is not already provided by the caller
(i.e., if options.storybookVersionSpecifier is falsy/undefined). Locate the
assignment in PreflightCheckCommand and guard it with a check against the
existing options.storybookVersionSpecifier so callers' explicit specifiers are
preserved.
Package BenchmarksCommit: The following packages have significant changes to their size or dependencies:
|
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 72 | 60 | 🎉 -12 🎉 |
| Self size | 20.30 MB | 20.52 MB | 🚨 +219 KB 🚨 |
| Dependency size | 36.17 MB | 32.84 MB | 🎉 -3.34 MB 🎉 |
| Bundle Size Analyzer | Link | Link |
@storybook/nextjs
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 534 | 534 | 0 |
| Self size | 662 KB | 651 KB | 🎉 -12 KB 🎉 |
| Dependency size | 61.35 MB | 61.35 MB | 🎉 -276 B 🎉 |
| Bundle Size Analyzer | Link | Link |
@storybook/nextjs-vite
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 93 | 93 | 0 |
| Self size | 1.38 MB | 1.37 MB | 🎉 -13 KB 🎉 |
| Dependency size | 24.78 MB | 24.78 MB | 🎉 -662 B 🎉 |
| Bundle Size Analyzer | Link | Link |
@storybook/cli
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 203 | 194 | 🎉 -9 🎉 |
| Self size | 908 KB | 912 KB | 🚨 +4 KB 🚨 |
| Dependency size | 87.59 MB | 84.57 MB | 🎉 -3.02 MB 🎉 |
| Bundle Size Analyzer | Link | Link |
@storybook/codemod
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 196 | 187 | 🎉 -9 🎉 |
| Self size | 32 KB | 32 KB | 🎉 -12 B 🎉 |
| Dependency size | 86.08 MB | 83.06 MB | 🎉 -3.02 MB 🎉 |
| Bundle Size Analyzer | Link | Link |
create-storybook
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 73 | 61 | 🎉 -12 🎉 |
| Self size | 1.08 MB | 1.08 MB | 🎉 -2 KB 🎉 |
| Dependency size | 56.48 MB | 53.36 MB | 🎉 -3.12 MB 🎉 |
| Bundle Size Analyzer | node | node |
|
Failed to publish preview packages for this pull request, triggered by @JReinhold. See the failed workflow run at: https://github.com/storybookjs/storybook/actions/runs/26125027066 |
|
Failed to publish canary packages for this pull request, triggered by @JReinhold. See the failed workflow run at: https://github.com/storybookjs/storybook/actions/runs/26148303832 |
|
Failed to publish canary packages for this pull request, triggered by @JReinhold. See the failed workflow run at: https://github.com/storybookjs/storybook/actions/runs/26161770373 |
1 similar comment
|
Failed to publish canary packages for this pull request, triggered by @JReinhold. See the failed workflow run at: https://github.com/storybookjs/storybook/actions/runs/26161770373 |
|
Failed to publish canary packages for this pull request, triggered by @JReinhold. See the failed workflow run at: https://github.com/storybookjs/storybook/actions/runs/26162172935 |
Closes #
What I did
Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
Caution
This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!
Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal,ci:mergedorci:dailyGH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.tsMake sure this PR contains one of the labels below:
Available labels
bug: Internal changes that fixes incorrect behavior.maintenance: User-facing maintenance tasks.dependencies: Upgrading (sometimes downgrading) dependencies.build: Internal-facing build tooling & test updates. Will not show up in release changelog.cleanup: Minor cleanup style change. Will not show up in release changelog.documentation: Documentation only changes. Will not show up in release changelog.feature request: Introducing a new feature.BREAKING CHANGE: Changes that break compatibility in some way with current major version.other: Changes that don't fit in the above categories.🦋 Canary Release - 💥 Failed
This PR does not have a canary release associated. Canary releases are automatically created when one of
ci:normal,ci:merged, orci:dailylabels are added to the PR.Summary by CodeRabbit
Chores
New Features