name: Chromatic on: push: branches: - main pull_request: pull_request_target: types: [labeled] # cancel in-progress runs on new commits to same PR (gitub.event.number) concurrency: group: ${{ github.workflow }}-${{ github.event.number || github.sha }} cancel-in-progress: true permissions: contents: read # to fetch code (actions/checkout) jobs: chromatic: # Run on push, regular PR (for repo branches), or labeled PR with safe-to-deploy (for forks) if: | github.event_name == 'push' || github.event_name == 'pull_request' || (github.event_name == 'pull_request_target' && github.event.label.name == 'safe-to-deploy') timeout-minutes: 20 runs-on: ubuntu-latest environment: name: development steps: - uses: actions/checkout@v4 with: fetch-depth: 2 # we need to fetch at least parent commit to satisfy Chromatic ref: ${{ github.event.pull_request.head.sha || github.sha }} # HEAD commit instead of merge commit # Storybook with submodules - uses: ./.github/actions/submodules-checkout with: submodules-ssh-key: ${{ secrets.PRIVATE_GITHUB_DEPLOY_TOKEN }} - uses: ./.github/actions/ci-setup - name: Chromatic id: chromatic uses: chromaui/action@v11.3.0 with: projectToken: bea8dc1981d4 buildScriptName: storybook:build