Adjust Chromatic to run conditionally (#37050)

This commit is contained in:
Echo
2025-11-28 14:37:04 +01:00
committed by GitHub
parent f896bbac3b
commit 84ffb107c3

View File

@@ -1,11 +1,30 @@
name: 'Chromatic' name: 'Chromatic'
permissions:
contents: read
on: on:
push: push:
branches-ignore: branches-ignore:
- renovate/* - renovate/*
- stable-* - stable-*
paths:
jobs:
pathcheck:
name: Check for relevant changes
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.filter.outputs.src }}
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
src:
- 'package.json' - 'package.json'
- 'yarn.lock' - 'yarn.lock'
- '**/*.js' - '**/*.js'
@@ -16,16 +35,17 @@ on:
- '**/*.scss' - '**/*.scss'
- '.github/workflows/chromatic.yml' - '.github/workflows/chromatic.yml'
jobs:
chromatic: chromatic:
name: Run Chromatic name: Run Chromatic
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.repository == 'mastodon/mastodon' needs: pathcheck
if: github.repository == 'mastodon/mastodon' && needs.pathcheck.outputs.changed == 'true'
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v5 uses: actions/checkout@v5
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Set up Javascript environment - name: Set up Javascript environment
uses: ./.github/actions/setup-javascript uses: ./.github/actions/setup-javascript
@@ -35,7 +55,8 @@ jobs:
- name: Run Chromatic - name: Run Chromatic
uses: chromaui/action@v13 uses: chromaui/action@v13
with: with:
# ⚠️ Make sure to configure a `CHROMATIC_PROJECT_TOKEN` repository secret
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
zip: true zip: true
storybookBuildDir: 'storybook-static' storybookBuildDir: 'storybook-static'
exitZeroOnChanges: false # Fail workflow if changes are found
autoAcceptChanges: 'main' # Auto-accept changes on main branch only