Skip to content

Commit 512e903

Browse files
enable running chromatic on forks (#1672)
adding the chromatic token to package.json, so it can run on forks too. --------- Signed-off-by: Peter Jausovec <peter.jausovec@solo.io> Co-authored-by: Jet Chiang <pokyuen.jetchiang-ext@solo.io>
1 parent 6cb7027 commit 512e903

3 files changed

Lines changed: 49 additions & 18 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -199,16 +199,12 @@ jobs:
199199
200200
ui-tests:
201201
runs-on: ubuntu-latest
202-
env:
203-
CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
204202
permissions:
205203
contents: read
206204
pull-requests: write
207205
steps:
208206
- name: Checkout repository
209207
uses: actions/checkout@v6
210-
with:
211-
fetch-depth: 0
212208

213209
- name: Setup Node.js
214210
uses: actions/setup-node@v6
@@ -239,19 +235,6 @@ jobs:
239235
working-directory: ./ui
240236
run: npm run test:vitest
241237

242-
- name: Build Storybook
243-
working-directory: ./ui
244-
run: npm run build-storybook
245-
246-
- name: Publish to Chromatic
247-
# Requires repo secret CHROMATIC_PROJECT_TOKEN. Skipped when unset, or on fork PRs (no token access).
248-
if: ${{ env.CHROMATIC_PROJECT_TOKEN != '' && (github.event.pull_request == null || github.event.pull_request.head.repo.full_name == github.repository) }}
249-
uses: chromaui/action@v16.1.0
250-
with:
251-
projectToken: ${{ env.CHROMATIC_PROJECT_TOKEN }}
252-
workingDir: ui
253-
storybookBuildDir: storybook-static
254-
255238
# This job builds the Docker images for the controller, UI, app, and CLI on arm64.
256239
build:
257240
needs: setup
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: UI Storybook & Chromatic
2+
3+
# Storybook static build + Chromatic only when the UI package changes.
4+
# Kept separate from CI so the main workflow does not need paths-filter or conditional steps.
5+
6+
on:
7+
push:
8+
branches: [main, release/v0.7.x]
9+
paths:
10+
- "ui/**"
11+
pull_request:
12+
branches: [main, release/v0.7.x]
13+
paths:
14+
- "ui/**"
15+
workflow_dispatch:
16+
17+
jobs:
18+
chromatic:
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
pull-requests: write
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v6
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Setup Node.js
30+
uses: actions/setup-node@v6
31+
with:
32+
node-version: "24"
33+
cache: "npm"
34+
cache-dependency-path: ui/package-lock.json
35+
36+
- name: Install dependencies
37+
working-directory: ./ui
38+
env:
39+
CYPRESS_INSTALL_BINARY: 0
40+
run: npm ci
41+
42+
- name: Build Storybook
43+
working-directory: ./ui
44+
run: npm run build-storybook
45+
46+
- name: Publish to Chromatic
47+
working-directory: ./ui
48+
run: npm run chromatic

ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"test:e2e": "start-server-and-test dev http://localhost:8001 test:e2e:cypress",
1515
"storybook": "storybook dev -p 6006",
1616
"build-storybook": "storybook build",
17-
"chromatic": "chromatic --exit-zero-on-changes"
17+
"chromatic": "chromatic --exit-zero-on-changes --storybook-build-dir storybook-static --project-token chpt_3e29f54d624610f"
1818
},
1919
"dependencies": {
2020
"@a2a-js/sdk": "^0.3.13",

0 commit comments

Comments
 (0)