Skip to content

Commit dc89120

Browse files
Add Chromatic to PR checks
1 parent 61ad4ca commit dc89120

File tree

5 files changed

+42
-32
lines changed

5 files changed

+42
-32
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ updates:
4444
- '@types/jest'
4545
- '@types/jest-*'
4646
- 'babel-*'
47+
- 'chromatic'
4748
- 'jest'
4849
- 'jest-*'
4950

.github/workflows/ci.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,18 @@ 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
23+
with:
24+
fetch-depth: 0
1625

1726
- name: Enable corepack
1827
run: corepack enable
@@ -37,3 +46,14 @@ jobs:
3746

3847
- name: Storybook build
3948
run: yarn build-storybook
49+
50+
- name: Switch to PR branch SHA
51+
if: ${{ github.event.pull_request && env.CHROMATIC_PROJECT_TOKEN }}
52+
run: git switch --detach $CHROMATIC_SHA
53+
54+
- name: Storybook deploy
55+
uses: chromaui/action@v11
56+
with:
57+
autoAcceptChanges: main
58+
projectToken: ${{ env.CHROMATIC_PROJECT_TOKEN }}
59+
token: ${{ env.GITHUB_TOKEN }}

.github/workflows/storybook.yml

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

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
"babel-jest": "^30.2.0",
9494
"babel-plugin-module-resolver": "^5.0.2",
9595
"babel-plugin-replace-import-extension": "^1.1.5",
96+
"chromatic": "^13.3.0",
9697
"classnames": "^2.5.1",
9798
"eslint": "^9.37.0",
9899
"eslint-config-prettier": "^10.1.8",

yarn.lock

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4718,6 +4718,25 @@ __metadata:
47184718
languageName: node
47194719
linkType: hard
47204720

4721+
"chromatic@npm:^13.3.0":
4722+
version: 13.3.0
4723+
resolution: "chromatic@npm:13.3.0"
4724+
peerDependencies:
4725+
"@chromatic-com/cypress": ^0.*.* || ^1.0.0
4726+
"@chromatic-com/playwright": ^0.*.* || ^1.0.0
4727+
peerDependenciesMeta:
4728+
"@chromatic-com/cypress":
4729+
optional: true
4730+
"@chromatic-com/playwright":
4731+
optional: true
4732+
bin:
4733+
chroma: dist/bin.js
4734+
chromatic: dist/bin.js
4735+
chromatic-cli: dist/bin.js
4736+
checksum: 10c0/496656850cc6498fa101cb17bb8adc9256df70c404f01be1cc6edcdd66fd97ab573a3fe858c581cf45d7279bcab0e170cb054dc3b2e2ef104ac0af9e6df38223
4737+
languageName: node
4738+
linkType: hard
4739+
47214740
"ci-info@npm:^3.2.0":
47224741
version: 3.9.0
47234742
resolution: "ci-info@npm:3.9.0"
@@ -8509,6 +8528,7 @@ __metadata:
85098528
babel-jest: "npm:^30.2.0"
85108529
babel-plugin-module-resolver: "npm:^5.0.2"
85118530
babel-plugin-replace-import-extension: "npm:^1.1.5"
8531+
chromatic: "npm:^13.3.0"
85128532
classnames: "npm:^2.5.1"
85138533
eslint: "npm:^9.37.0"
85148534
eslint-config-prettier: "npm:^10.1.8"

0 commit comments

Comments
 (0)