Skip to content

Bump tar-fs from 2.1.1 to 2.1.2 in /docs/storybook #519

Bump tar-fs from 2.1.1 to 2.1.2 in /docs/storybook

Bump tar-fs from 2.1.1 to 2.1.2 in /docs/storybook #519

name: Snapshots
on:
pull_request:
types: [labeled]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
update-snapshots-runner:
if: ${{ github.event.label.name == 'update snapshots' }}
runs-on: ubuntu-latest
strategy:
matrix:
shard: [1, 2, 3, 4]
steps:
- uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Install dependencies
run: npm ci --no-audit --no-fund --ignore-scripts
- name: Install browsers
run: npx playwright install --with-deps
- name: Build tokens
run: npm run build:tokens
- name: Build storybook
working-directory: docs/storybook
run: |
npm ci
npm run build-storybook
- name: Run storybook
id: storybook
run: |
npx serve -l 6006 storybook-static &
pid=$!
echo "pid=$pid" >> $GITHUB_OUTPUT
sleep 5
working-directory: docs/storybook
- name: Run Visual Regression Tests
run: npx playwright test --update-snapshots --shard="${{ matrix.shard }}/${{ strategy.job-total }}"
- name: Stop storybook
run: kill ${{ steps.storybook.outputs.pid }}
- name: Create snapshots.zip
run: |
if [[ ! -z $(git ls-files --others --exclude-standard --modified) ]]; then
git ls-files --others --exclude-standard --modified | zip snapshots -@
fi
- name: Upload snapshots
uses: actions/upload-artifact@v4
with:
name: snapshots-${{ matrix.shard }}
path: snapshots.zip
retention-days: 1
if-no-files-found: ignore
update:
name: 'Update snapshots'
needs: update-snapshots-runner
runs-on: ubuntu-latest
steps:
- name: Generate token
id: generate_token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.VRT_APP_ID }}
private-key: ${{ secrets.VRT_PRIVATE_KEY }}
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.head_ref }}
token: ${{ steps.generate_token.outputs.token }}
- uses: actions/download-artifact@v4
with:
path: snapshots
pattern: snapshots-*
- run: |
for snapshots in snapshots/*/*.zip; do
unzip -o "$snapshots" -d .
done
rm -rf snapshots
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: github-actions[bot] Regenerated snapshots
- uses: actions-ecosystem/action-remove-labels@v1
if: always()
with:
labels: 'update snapshots'