infra: Run Chromatic only on PR events, not Push event (#2562) #7686
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Chromatic | |
on: | |
pull_request: | |
types: [opened, synchronize] | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
name: Build | |
uses: ./.github/workflows/build-and-upload.yml | |
secrets: | |
npm_token: ${{ secrets.npm_token }} | |
publish-chromatic: | |
name: Publish Chromatic | |
needs: build | |
if: ${{ needs.build.outputs.has_changes == 'true' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Run Setup | |
uses: ./.github/actions/setup | |
with: | |
npm_token: ${{ secrets.npm_token }} | |
- uses: ./.github/actions/download-builds | |
- name: Publish to Chromatic | |
uses: chromaui/action@v11 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} | |
workingDir: packages/core | |
exitOnceUploaded: true |