Skip to content

Chromatic

Chromatic #8421

Workflow file for this run

name: Chromatic
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
pull_request_review:
types: [submitted]
concurrency:
group: chromatic-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
changeset:
runs-on: blacksmith-2vcpu-ubuntu-2204
steps:
- name: Determine changed files
uses: tomi/[email protected]
id: changed
if: github.event_name == 'pull_request_review'
with:
filters: |
design_system:
- 'packages/frontend/@n8n/design-system/**'
- '.github/workflows/storybook.yml'
outputs:
has_changes: ${{ steps.changed.outputs.design_system || 'false' }}
chromatic:
needs: [changeset]
if: |
github.event_name == 'workflow_dispatch' ||
(
github.event_name == 'pull_request_review' &&
needs.changeset.outputs.has_changes == 'true' &&
github.event.review.state == 'approved' &&
!contains(github.event.pull_request.labels.*.name, 'community')
)
runs-on: blacksmith-2vcpu-ubuntu-2204
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
- name: Setup Node.js
uses: n8n-io/n8n/.github/actions/setup-nodejs-blacksmith@f5fbbbe0a28a886451c886cac6b49192a39b0eea # v1.104.1
with:
build-command: pnpm run build --filter=@n8n/utils --filter=@n8n/vitest-config --filter=@n8n/design-system
- name: Publish to Chromatic
uses: chromaui/action@1cfa065cbdab28f6ca3afaeb3d761383076a35aa # v11
id: chromatic_tests
continue-on-error: true
with:
workingDir: packages/frontend/@n8n/design-system
onlyChanged: true
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
exitZeroOnChanges: false
- name: Success comment
if: steps.chromatic_tests.outcome == 'success' && github.ref != 'refs/heads/master'
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # 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' && github.ref != 'refs/heads/master'
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # 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}}