-
Notifications
You must be signed in to change notification settings - Fork 55
62 lines (54 loc) · 2.07 KB
/
visual-testing.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Visual testing
on:
workflow_dispatch:
pull_request:
# By default, a workflow only runs when a pull_request event's activity type is opened, synchronize, or reopened
types: [labeled, synchronize, opened, reopened, ready_for_review]
branches:
- master
push:
branches:
- master
# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
permissions:
contents: read
deployments: read
pull-requests: write
statuses: write
jobs:
build:
runs-on: ubuntu-latest
environment: pull_request_unsafe
if: ( github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'need visual approval') )
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
with:
fetch-depth: 0
- name: Use Node.js
uses: ./.github/actions/setup-node
- name: Install dependencies
run: yarn --frozen-lock
- name: Publish PR to DS Chromatic
if: github.ref != 'refs/heads/master'
# https://github.com/chromaui/chromatic-cli/issues/739
uses: chromaui/action@v10
with:
token: ${{ secrets.GITHUB_TOKEN }}
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
workingDir: packages/storybook-one
exitZeroOnChanges: true # Option to prevent the workflow from failing in PR
# Handle monorepos https://www.chromatic.com/docs/monorepos
forceRebuild: true
- name: Publish Master to DS Chromatic
if: github.ref == 'refs/heads/master'
# https://github.com/chromaui/chromatic-cli/issues/739
uses: chromaui/action@v10
with:
token: ${{ secrets.GITHUB_TOKEN }}
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
workingDir: packages/storybook-one
autoAcceptChanges: true # Option to accept any change for this baseline refresh
forceRebuild: true