Skip to content

Changeset: New Version (#1007) #3997

Changeset: New Version (#1007)

Changeset: New Version (#1007) #3997

Workflow file for this run

# Chromatic Main and Active PRs only
# Trigger example found here: https://github.com/chromaui/chromatic-cli/blob/main/.github/workflows/chromatic-main-and-prs.yml
name: Chromatic
on:
push:
branches:
- main
pull_request:
# Opened, synchronize, or reopened are the default types
# We added ready_for_review to trigger the workflow is passed from draft to ready_for_review
types: ["opened", "synchronize", "reopened", "ready_for_review"]
concurrency:
group: chromatic-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
chromatic:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout Commit
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Setup Node and PNPM
uses: ./.github/composite-actions/setup
- name: Install dependencies
run: pnpm i --frozen-lockfile
- name: Restore Turborepo cache
id: cache-turborepo-restore
uses: actions/cache/restore@v6
with:
key: ${{ runner.os }}-turborepo-${{ github.sha }}-chromatic
restore-keys: |
${{ runner.os }}-turborepo-
path: .turbo
- name: Build Packages
run: pnpm build:pkg
- name: Save Turborepo cache
id: cache-turborepo-save
if: always() && steps.cache-turborepo-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v6
with:
key: ${{ steps.cache-turborepo-restore.outputs.cache-primary-key }}
path: .turbo
- name: Publish to Chromatic
uses: chromaui/action@v18
id: chromatic
with:
autoAcceptChanges: "main"
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
traceChanged: true
onlyChanged: true # TurboSnap
externals: "packages/tokens/src/tokens/**" # Token JSON files are outside the bundler's module graph; when they change the generated CSS changes, affecting all stories
exitOnceUploaded: true # The PRs will be marked as success/failure based on the Chromatic build status
skip: ${{ github.event.pull_request.draft == true || startsWith(github.ref, 'refs/heads/changeset-release/') }}
- name: Write to GitHub comment
uses: thollander/actions-comment-pull-request@v3
with:
message: |
[View Storybook](${{ steps.chromatic.outputs.storybookUrl }})
comment-tag: storybook_url
if: github.event_name == 'pull_request'