2024-03-15 07:14:45 -07:00
|
|
|
name: Chromatic
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
2024-06-03 03:39:55 -07:00
|
|
|
pull_request_review:
|
|
|
|
types: [submitted]
|
2024-08-22 02:41:53 -07:00
|
|
|
branches:
|
2024-06-03 03:39:55 -07:00
|
|
|
- 'master'
|
2024-05-08 05:33:53 -07:00
|
|
|
paths:
|
|
|
|
- packages/design-system/**
|
|
|
|
- .github/workflows/chromatic.yml
|
2024-03-15 07:14:45 -07:00
|
|
|
|
2024-06-03 03:39:55 -07:00
|
|
|
concurrency:
|
|
|
|
group: chromatic-${{ github.event.pull_request.number || github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2024-03-15 07:14:45 -07:00
|
|
|
jobs:
|
|
|
|
chromatic:
|
2024-06-03 03:39:55 -07:00
|
|
|
if: ${{ github.event.review.state == 'approved' && !contains(github.event.pull_request.labels.*.name, 'community') }}
|
2024-03-15 07:14:45 -07:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4.1.1
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
- run: corepack enable
|
2024-05-24 03:32:50 -07:00
|
|
|
- uses: actions/setup-node@v4.0.2
|
2024-03-15 07:14:45 -07:00
|
|
|
with:
|
2024-05-24 03:32:50 -07:00
|
|
|
node-version: 20.x
|
2024-03-15 07:14:45 -07:00
|
|
|
cache: 'pnpm'
|
|
|
|
- run: pnpm install --frozen-lockfile
|
|
|
|
|
|
|
|
- name: Publish to Chromatic
|
2024-06-03 03:39:55 -07:00
|
|
|
uses: chromaui/action@v11
|
|
|
|
id: chromatic_tests
|
|
|
|
continue-on-error: true
|
2024-03-15 07:14:45 -07:00
|
|
|
with:
|
|
|
|
workingDir: packages/design-system
|
|
|
|
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
|
2024-06-03 03:39:55 -07:00
|
|
|
exitZeroOnChanges: false
|
|
|
|
|
|
|
|
- name: Success comment
|
|
|
|
if: steps.chromatic_tests.outcome == 'success'
|
|
|
|
uses: peter-evans/create-or-update-comment@v4.0.0
|
|
|
|
with:
|
|
|
|
issue-number: ${{ github.event.pull_request.number }}
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
edit-mode: replace
|
|
|
|
body: |
|
|
|
|
:white_check_mark: No visual regressions found.
|
|
|
|
|
|
|
|
- name: Fail comment
|
|
|
|
if: steps.chromatic_tests.outcome != 'success'
|
|
|
|
uses: peter-evans/create-or-update-comment@v4.0.0
|
|
|
|
with:
|
|
|
|
issue-number: ${{ github.event.pull_request.number }}
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
edit-mode: replace
|
|
|
|
body: |
|
|
|
|
[:warning: Visual regressions found](${{steps.chromatic_tests.outputs.url}}): ${{steps.chromatic_tests.outputs.changeCount}}
|