@@ -56,20 +56,26 @@ jobs:
5656 run : pnpm install
5757
5858 # Install playwright's binary under custom directory to cache
59- - name : Set Playwright path (non-windows)
59+ - name : (non-windows) Set Playwright path and Get playwright version
6060 if : runner.os != 'Windows'
61- run : echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-bin" >> $GITHUB_ENV
62- - name : Set Playwright path (windows)
61+ run : |
62+ echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-bin" >> $GITHUB_ENV
63+ PLAYWRIGHT_VERSION="$(pnpm ls --depth 0 --json -w playwright-chromium | jq --raw-output '.[0].devDependencies["playwright-chromium"].version')"
64+ echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV
65+ - name : (windows) Set Playwright path and Get playwright version
6366 if : runner.os == 'Windows'
64- run : echo "PLAYWRIGHT_BROWSERS_PATH=$HOME\.cache\playwright-bin" >> $env:GITHUB_ENV
67+ run : |
68+ echo "PLAYWRIGHT_BROWSERS_PATH=$HOME\.cache\playwright-bin" >> $env:GITHUB_ENV
69+ $env:PLAYWRIGHT_VERSION="$(pnpm ls --depth 0 --json -w playwright-chromium | jq --raw-output '.[0].devDependencies["playwright-chromium"].version')"
70+ echo "PLAYWRIGHT_VERSION=$env:PLAYWRIGHT_VERSION" >> $env:GITHUB_ENV
6571
6672 - name : Cache Playwright's binary
6773 uses : actions/cache@v4
6874 with :
69- # Playwright removes unused browsers automatically
70- # So does not need to add playwright version to key
71- key : ${{ runner.os }}-playwright-bin-v1
75+ key : ${{ runner.os }}-playwright-bin-v1-${{ env.PLAYWRIGHT_VERSION }}
7276 path : ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
77+ restore-keys : |
78+ ${{ runner.os }}-playwright-bin-v1-
7379
7480 - name : Install Playwright
7581 # does not need to explicitly set chromium after https://github.com/microsoft/playwright/issues/14862 is solved
0 commit comments