message: ci(vrt): add multiple runners to update snapshots
diff: @@ -9,23 +9,36 @@ concurrency:
  cancel-in-progress: true
  jobs:
  - update-snapshots:
  + storybook:
  if: >
  github.repository == 'primer/react' &&
  contains(github.event.pull_request.labels.*.name, 'update snapshots')
  runs-on: ubuntu-latest
  steps:
  - - name: Generate token
  - id: generate_token
  - uses: tibdex/github-app-token@v1
  + - name: Checkout repository
  + uses: actions/checkout@v3
  + - name: Set up Node.js
  + uses: actions/setup-node@v3
  with:
  - app_id: ${{ secrets.APP_ID }}
  - private_key: ${{ secrets.PRIVATE_KEY }}
  - - uses: actions/checkout@v3
  + node-version: 16
  + - name: Install dependencies
  + run: npm ci
  + - name: Build storybook
  + run: npx build-storybook
  + - uses: actions/upload-artifact@v3
  with:
  - repository: ${{ github.event.pull_request.head.repo.full_name }}
  - ref: ${{ github.head_ref }}
  - token: ${{ steps.generate_token.outputs.token }}
  + name: storybook
  + path: storybook-static
  +
  + update-snapshots:
  + needs: storybook
  + runs-on: ubuntu-latest
  + strategy:
  + fail-fast: false
  + matrix:
  + shard: [1, 2]
  + steps:
  + - uses: actions/checkout@v3
  - name: Use Node.js 16.x
  uses: actions/setup-node@v3
  with:
  @@ -34,8 +47,10 @@ jobs:
  run: npm ci
  - name: Install browsers
  run: npx playwright install --with-deps
  - - name: Build storybook
  - run: npx build-storybook
  + - uses: actions/download-artifact@v3
  + with:
  + name: storybook
  + path: storybook-static
  - name: Run storybook
  id: storybook
  run: |
  @@ -44,15 +59,37 @@ jobs:
  echo "pid=$pid" >> $GITHUB_OUTPUT
  sleep 5
  - name: Run VRT
  - run: npx playwright test --grep @vrt --update-snapshots
  + run: npx playwright test --grep @vrt --update-snapshots --shard="${{ matrix.shard }}/2"
  - name: Stop storybook
  if: ${{ always() }}
  run: kill ${{ steps.storybook.outputs.pid }}
  + - name: Upload snapshots
  + uses: actions/upload-artifact@v3
  + with:
  + name: snapshots
  + path: .playwright/snapshots
  +
  + commit-snapshots:
  + needs: update-snapshots
  + runs-on: ubuntu-latest
  + steps:
  + - name: Generate token
  + id: generate_token
  + uses: tibdex/github-app-token@v1
  + with:
  + app_id: ${{ secrets.APP_ID }}
  + private_key: ${{ secrets.PRIVATE_KEY }}
  + - uses: actions/checkout@v3
  + with:
  + repository: ${{ github.event.pull_request.head.repo.full_name }}
  + ref: ${{ github.head_ref }}
  + token: ${{ steps.generate_token.outputs.token }}
  + - uses: actions/download-artifact@v3
  + with:
  + name: snapshots
  - uses: stefanzweifel/git-auto-commit-action@v4
  with:
  commit_message: 'test(vrt): update snapshots'
  - env:
  - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  - uses: actions-ecosystem/action-remove-labels@v1
  with:
  labels: 'update snapshots'
  