Skip to content

Version Packages

Version Packages #2138

Workflow file for this run

name: Chromatic - Pull Request
on:
pull_request:
# This allows us to run the workflow on PRs from when they move from draft
# to non-draft.
types: [edited, opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
chromatic_changesets:
# Only run this workflow when the Release PR is opened/created.
if: startsWith(github.head_ref, 'changeset-release/')
name: Chromatic - Skip on Release PR (changesets)
uses: ./.github/workflows/chromatic-build.yml
with:
target: 'bot'
secrets:
projectToken: ${{ secrets.CHROMATIC_APP_CODE }}
# ------- Regular PRs --------
chromatic_review:
# (if) Run this step on regular PRs.
if: |
github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]' &&
!startsWith(github.head_ref, 'changeset-release/')
name: Chromatic - Build on regular PRs
uses: ./.github/workflows/chromatic-build.yml
with:
target: 'review'
secrets:
projectToken: ${{ secrets.CHROMATIC_APP_CODE }}
chromatic_review_results:
# (if) Run this step on regular PRs.
if: |
github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]' &&
!startsWith(github.head_ref, 'changeset-release/')
name: Chromatic - Get results on regular PRs
needs: chromatic_review
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
node-version: [20.x]
steps:
# Create/update PR comment with Chromatic results
- name: Find existing comment
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: A new build was pushed to Chromatic!
- name: Create or update comment
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
edit-mode: replace
issue-number: ${{ github.event.pull_request.number }}
body: |
# A new build was pushed to Chromatic! :rocket:
${{ needs.chromatic_review.outputs.storybookUrl }}
## Chromatic results:
| Metric | Total |
|---|---|
| Captured snapshots | ${{ needs.chromatic_review.outputs.actualCaptureCount }} |
| Tests with visual changes | ${{ needs.chromatic_review.outputs.changeCount }} |
| Total stories | ${{ needs.chromatic_review.outputs.specCount }} |
| Inherited (not captured) snapshots [TurboSnap] | ${{ needs.chromatic_review.outputs.inheritedCaptureCount }} |
| Tests on the build | ${{ needs.chromatic_review.outputs.testCount }} |