name: Chromatic on: workflow_call concurrency: group: ${{ github.workflow }}-${{ github.ref }}-chromatic cancel-in-progress: true permissions: pull-requests: write actions: write contents: read jobs: chromatic: name: Chromatic runs-on: ubuntu-latest env: CI: true defaults: run: working-directory: ./dashboard steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: pnpm/action-setup@v3 name: Install pnpm with: version: 8 run_install: false - name: Get pnpm store directory shell: bash run: | echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - uses: actions/cache@v3 name: Setup pnpm cache with: path: ${{ env.STORE_PATH }} key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-pnpm-store- - name: 📥 Install deps run: pnpm install - name: Build Storybook run: pnpm run build-storybook - name: ⚡ Run chromatic uses: chromaui/action@latest id: chromatic with: projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} exitZeroOnChanges: true workingDir: ./dashboard autoAcceptChanges: "main" exitOnceUploaded: true onlyChanged: true skip: "@(renovate/**|dependabot/**)" zip: true - name: Publish Chromatic Action Summary run: echo -e "| Results | |\n| --- | --- |\n| Build Results | ${{steps.chromatic.outputs.buildUrl}} |\n| Storybook Preview | ${{steps.chromatic.outputs.storybookUrl}} |\n| Component Count | ${{steps.chromatic.outputs.componentCount}} |" >> $GITHUB_STEP_SUMMARY - name: Publish Chromatic Link in the comments uses: dannyhw/storybook-chromatic-link-comment@v0.11 with: github-token: ${{ secrets.GITHUB_TOKEN }} review-url: ${{ steps.chromatic.outputs.url }} build-url: ${{ steps.chromatic.outputs.buildUrl }} storybook-url: ${{ steps.chromatic.outputs.storybookUrl }}