Skip to content

Ci: Allow branch selection for sandbox generation#34618

Merged
huang-julien merged 3 commits into
nextfrom
ci/generate_sandbox_selection
Apr 27, 2026
Merged

Ci: Allow branch selection for sandbox generation#34618
huang-julien merged 3 commits into
nextfrom
ci/generate_sandbox_selection

Conversation

@huang-julien
Copy link
Copy Markdown
Contributor

@huang-julien huang-julien commented Apr 23, 2026

Closes #

What I did

This PR changes the generate sandbox CI to allow selection of the source branch from which is generation is run from

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

verify sandbox generation action can be selected with any other branch

Caution

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Make 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

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook publish.yml --field pr=<PR_NUMBER>

Summary by CodeRabbit

  • Chores
    • Consolidated sandbox generation into a single matrix-driven workflow that handles both manual and scheduled runs.
    • Added branch-selection so manual runs target the invoked branch and scheduled runs target both main and next.
    • Updated failure reporting to reference the active branch and removed duplicate branch-specific jobs.

@huang-julien huang-julien added build Internal-facing build tooling & test updates ci:merged Run the CI jobs that normally run when merged. labels Apr 23, 2026
@huang-julien huang-julien changed the title ci: allow branch selection for sandbox generation Ci: Allow branch selection for sandbox generation Apr 23, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 23, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 31d9f2b2-f1ca-49e4-888d-87ea9c93d3b1

📥 Commits

Reviewing files that changed from the base of the PR and between b069d80 and 645df83.

📒 Files selected for processing (1)
  • .github/workflows/generate-sandboxes.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/generate-sandboxes.yml

📝 Walkthrough

Walkthrough

Replaces two fixed sandbox-generation jobs with a matrix-driven generate job and adds set-branches to compute target branches (manual runs: selected ref; scheduled: next and main). Checkout, publish, and failure notifications now use the matrix branch variable.

Changes

Cohort / File(s) Summary
Workflow Job Refactoring
.github/workflows/generate-sandboxes.yml
Replaces generate-next/generate-main with a single matrix-driven generate job and a set-branches job that emits branches based on trigger. generate now checks out matrix.branch, adjusts publish --branch argument (scheduled -> matrix branch; manual -> next), and updates Discord failure messaging to include matrix.branch. Removes duplicated fixed-branch jobs/steps.

Sequence Diagram(s)

sequenceDiagram
    participant Trigger as GitHub Actions Trigger
    participant SetBranches as set-branches Job
    participant Matrix as generate Job (matrix.branch)
    participant Checkout as actions/checkout
    participant Generate as sandbox generation steps
    participant Publish as publish step
    participant Discord as Discord notifier

    Trigger->>SetBranches: compute target branches (workflow_dispatch -> [ref], schedule -> [next, main])
    SetBranches-->>Matrix: provide branches for matrix
    loop for each matrix.branch
        Matrix->>Checkout: checkout repo @ matrix.branch
        Checkout->>Generate: run generation/build steps
        Generate->>Publish: publish with branch arg (scheduled: matrix.branch, manual: next)
        Publish-->>Matrix: success/failure
        alt failure
            Matrix->>Discord: send failure message referencing matrix.branch
        end
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs


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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/generate-sandboxes.yml:
- Around line 30-37: The run block under the step with id "set" in the GitHub
Actions workflow inlines `${{ github.ref_name }}` into a shell script which
risks template/shell injection; instead pass the ref through env (e.g.,
REF_NAME: ${{ github.ref_name }}) and reference it inside the run body as a
shell variable (e.g., "$REF_NAME"), then construct the branches JSON safely (for
example using jq or by validating/escaping REF_NAME) and write it to
$GITHUB_OUTPUT; update only the step containing the run, keep the same logic for
workflow_dispatch vs default branches, and ensure all references to the inline
`${{ github.ref_name }}` are replaced with the environment variable.
🪄 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: eed87730-d98a-4b24-880d-5b963c2667bb

📥 Commits

Reviewing files that changed from the base of the PR and between b9549a6 and 06d6ec1.

📒 Files selected for processing (1)
  • .github/workflows/generate-sandboxes.yml

Comment thread .github/workflows/generate-sandboxes.yml
@storybook-app-bot
Copy link
Copy Markdown

storybook-app-bot Bot commented Apr 23, 2026

Package Benchmarks

Commit: 645df83, ran on 23 April 2026 at 20:09:47 UTC

The following packages have significant changes to their size or dependencies:

@storybook/builder-webpack5

Before After Difference
Dependency count 186 186 0
Self size 76 KB 76 KB 0 B
Dependency size 32.78 MB 32.89 MB 🚨 +111 KB 🚨
Bundle Size Analyzer Link Link

@storybook/angular

Before After Difference
Dependency count 185 185 0
Self size 140 KB 140 KB 0 B
Dependency size 30.44 MB 30.54 MB 🚨 +106 KB 🚨
Bundle Size Analyzer Link Link

@storybook/ember

Before After Difference
Dependency count 190 190 0
Self size 15 KB 15 KB 0 B
Dependency size 29.50 MB 29.61 MB 🚨 +111 KB 🚨
Bundle Size Analyzer Link Link

@storybook/nextjs

Before After Difference
Dependency count 535 535 0
Self size 650 KB 650 KB 0 B
Dependency size 60.80 MB 60.91 MB 🚨 +111 KB 🚨
Bundle Size Analyzer Link Link

@storybook/react-webpack5

Before After Difference
Dependency count 273 273 0
Self size 23 KB 23 KB 🎉 -12 B 🎉
Dependency size 45.41 MB 45.52 MB 🚨 +111 KB 🚨
Bundle Size Analyzer Link Link

@storybook/server-webpack5

Before After Difference
Dependency count 198 198 0
Self size 16 KB 16 KB 🎉 -12 B 🎉
Dependency size 34.04 MB 34.15 MB 🚨 +111 KB 🚨
Bundle Size Analyzer Link Link

@storybook/preset-react-webpack

Before After Difference
Dependency count 166 166 0
Self size 18 KB 18 KB 0 B
Dependency size 31.78 MB 31.89 MB 🚨 +111 KB 🚨
Bundle Size Analyzer Link Link

Copy link
Copy Markdown
Contributor

@JReinhold JReinhold left a comment

Choose a reason for hiding this comment

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

nice, this is clever.

@huang-julien huang-julien merged commit 1b2330f into next Apr 27, 2026
178 of 180 checks passed
@huang-julien huang-julien deleted the ci/generate_sandbox_selection branch April 27, 2026 11:15
@github-actions github-actions Bot mentioned this pull request Apr 27, 2026
16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Internal-facing build tooling & test updates ci:merged Run the CI jobs that normally run when merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants