From 45c8d70f58d8db2a917912a3d589aa31575a1cd5 Mon Sep 17 00:00:00 2001 From: Chris Wilkinson Date: Tue, 7 Jan 2025 11:46:19 +0000 Subject: [PATCH] Match the Playwright version in CI --- .dockerignore | 1 + .github/workflows/fix-playwright-versions.yml | 42 +++++++++++++++++++ scripts/fix-playwright-versions.sh | 9 ++++ 3 files changed, 52 insertions(+) create mode 100644 .github/workflows/fix-playwright-versions.yml create mode 100755 scripts/fix-playwright-versions.sh diff --git a/.dockerignore b/.dockerignore index 93c699a..335b1ba 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,4 +4,5 @@ /integration/ /integration-results/ /node_modules/ +/scripts/ /src/.observablehq/ diff --git a/.github/workflows/fix-playwright-versions.yml b/.github/workflows/fix-playwright-versions.yml new file mode 100644 index 0000000..02122e0 --- /dev/null +++ b/.github/workflows/fix-playwright-versions.yml @@ -0,0 +1,42 @@ +name: Fix Playwright versions + +on: + push: + branches: + - 'dependabot/npm_and_yarn/playwright/test-*' + +permissions: + contents: read + +jobs: + fix-playwright-versions: + name: 'Fix Playwright versions' + runs-on: ubuntu-22.04 + timeout-minutes: 30 + + steps: + - name: 'Checkout code' + uses: actions/checkout@v4.1.7 + with: + token: ${{ secrets.PREREVIEW_BOT_TOKEN }} + + - name: 'Set up Node.js' + uses: actions/setup-node@v4.0.3 + with: + node-version-file: package.json + cache: ${{ !env.ACT && 'npm' || '' }} + + - name: 'Install dependencies' + run: npm ci --ignore-scripts + + - name: 'Fix Playwright versions' + run: scripts/fix-playwright-versions.sh + + - name: 'Upload assets' + uses: stefanzweifel/git-auto-commit-action@v5.0.1 + if: ${{ !env.ACT }} + with: + commit_message: '[dependabot skip] Fix Playwright versions' + commit_user_name: 'prereview-bot' + commit_user_email: 'engineering@prereview.org' + commit_author: 'prereview-bot ' diff --git a/scripts/fix-playwright-versions.sh b/scripts/fix-playwright-versions.sh new file mode 100755 index 0000000..9be4604 --- /dev/null +++ b/scripts/fix-playwright-versions.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +set -e + +version=$(npm list --depth=0 --json --package-lock-only | jq --raw-output '.dependencies."@playwright/test".version') + +echo "Found @playwright/test $version" + +echo "Updating CI" +sed --in-place --regexp-extended "s/mcr\.microsoft\.com\/playwright:v.+?-jammy/mcr.microsoft.com\/playwright:v$version-jammy/g" .github/workflows/ci.yml