Skip to content

Commit a9847f3

Browse files
Add Chromatic to PR checks
1 parent 3faed78 commit a9847f3

File tree

2 files changed

+24
-32
lines changed

2 files changed

+24
-32
lines changed

.github/workflows/ci.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ jobs:
1010
build:
1111
runs-on: ubuntu-latest
1212

13+
env:
14+
CHROMATIC_BRANCH: ${{ github.event.pull_request.head.ref || github.ref_name }}
15+
CHROMATIC_SHA: ${{ github.event.pull_request.head.sha || github.ref }}
16+
CHROMATIC_SLUG: ${{ github.repository }}
17+
CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
1320
steps:
1421
- name: Checkout
1522
uses: actions/checkout@v5
@@ -37,3 +44,20 @@ jobs:
3744

3845
- name: Storybook build
3946
run: yarn build-storybook
47+
48+
- name: Switch to PR branch
49+
if: ${{ github.event_name == 'pull_request' && env.CHROMATIC_PROJECT_TOKEN }}
50+
uses: actions/checkout@v5
51+
with:
52+
clean: false
53+
fetch-depth: 0
54+
ref: ${{ env.CHROMATIC_BRANCH }}
55+
56+
- name: Storybook deploy
57+
uses: chromaui/action@v13
58+
with:
59+
autoAcceptChanges: main
60+
branchName: ${{ env.CHROMATIC_BRANCH}}
61+
onlyChanged: ${{ github.event_name == 'pull_request' }}
62+
projectToken: ${{ env.CHROMATIC_PROJECT_TOKEN }}
63+
token: ${{ env.GITHUB_TOKEN }}

.github/workflows/storybook.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)