mirror of
https://github.com/n8n-io/n8n
synced 2026-04-21 15:47:20 +00:00
85 lines
3.1 KiB
YAML
85 lines
3.1 KiB
YAML
name: 'Test: Visual 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/paths-filter-action@32c62f5ca100c1110406e3477d5b3ecef4666fec # v3.0.2
|
|
id: changed
|
|
if: github.event_name == 'pull_request_review'
|
|
with:
|
|
filters: |
|
|
design_system:
|
|
- 'packages/frontend/@n8n/design-system/**'
|
|
- 'packages/frontend/@n8n/chat/**'
|
|
- 'packages/frontend/@n8n/storybook/**'
|
|
- '.github/workflows/test-visual-storybook.yml'
|
|
outputs:
|
|
has_changes: ${{ steps.changed.outputs.design_system || 'false' }}
|
|
|
|
chromatic:
|
|
needs: [changeset]
|
|
if: |
|
|
github.event_name == 'schedule' ||
|
|
github.event_name == 'workflow_dispatch' ||
|
|
(
|
|
github.event_name == 'pull_request_review' &&
|
|
needs.changeset.outputs.has_changes == 'true' &&
|
|
github.event.review.state == 'approved' &&
|
|
!startsWith(github.event.pull_request.head.ref, 'release/') &&
|
|
!startsWith(github.event.pull_request.head.ref, 'release-pr/')
|
|
)
|
|
runs-on: blacksmith-4vcpu-ubuntu-2204
|
|
steps:
|
|
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Node.js
|
|
uses: ./.github/actions/setup-nodejs
|
|
with:
|
|
build-command: pnpm run build --filter=@n8n/utils --filter=@n8n/vitest-config --filter=@n8n/chat --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/storybook
|
|
autoAcceptChanges: 'master'
|
|
skip: 'release/**'
|
|
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}}
|