Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Chromatic

on:
pull_request:
types: [opened, synchronize, labeled, closed]
types: [opened, synchronize, reopened, closed]
paths:
- 'packages/plan/**/*.tsx'
- 'packages/plan/**/*.css'
Expand All @@ -23,13 +23,12 @@ jobs:
name: Publish
runs-on: ubuntu-latest
timeout-minutes: 10
# Run if PR has 'chromatic' label AND either:
# 1. PR is open (opened, synchronize, labeled events), OR
# 2. PR was just merged to main (closed event with merged=true)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We don't need to be as conservative with runs since chromatic is free for OSS (IIRC)

# Triggered by the workflow-level paths filter (UI/CSS changes only). Skip the
# closed event unless it's a merge to main — closed-without-merge shouldn't
# republish baselines.
if: |
contains(github.event.pull_request.labels.*.name, 'chromatic') &&
(github.event.action != 'closed' ||
(github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main'))
github.event.action != 'closed' ||
(github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main')
steps:
- name: Checkout code
uses: actions/checkout@v6
Expand All @@ -43,6 +42,8 @@ jobs:

- name: Build Storybook
run: bun run --cwd packages/plan build-storybook
env:
SKIP_DEMO_STORIES: 'true'

- name: Deploy to Chromatic
# Use CLI directly instead of chromaui/action because the action overwrites
Expand Down
4 changes: 3 additions & 1 deletion packages/plan/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import type { StorybookConfig } from '@storybook/react-vite';

const skipDemo = process.env.SKIP_DEMO_STORIES === 'true';

const config: StorybookConfig = {
stories: ['../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
stories: [skipDemo ? '../src/**/!(*.demo).stories.@(js|jsx|mjs|ts|tsx)' : '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
addons: [],
framework: '@storybook/react-vite',
};
Expand Down
Loading
Loading