@@ -10,13 +10,47 @@ runs:
1010 using : " composite"
1111 steps :
1212 - name : Install pnpm
13- uses : pnpm/action-setup@v2
13+ uses : pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
1414
15- - uses : actions/setup-node@v4
15+ - name : Set node version to ${{ inputs.node-version }}
16+ uses : actions/setup-node@v4
1617 with :
1718 node-version : ${{ inputs.node-version }}
1819 registry-url : " https://registry.npmjs.org"
1920
21+ - name : Resolve package versions
22+ id : resolve-package-versions
23+ shell : bash
24+ run : >
25+ echo "$(
26+ node -e "
27+ const fs = require('fs');
28+ const lockfile = fs.readFileSync('./pnpm-lock.yaml', 'utf8');
29+ const pattern = (name) => new RegExp(name + ':\\\s+specifier: [\\\s\\\w\\\.^]+version: (\\\d+\\\.\\\d+\\\.\\\d+)');
30+ const playwrightVersion = lockfile.match(pattern('playwright'))[1];
31+ console.log('PLAYWRIGHT_VERSION=' + playwrightVersion);
32+ "
33+ )" >> $GITHUB_OUTPUT
34+
35+ - name : Print versions
36+ shell : bash
37+ run : echo "${{ toJson(steps.resolve-package-versions.outputs) }}"
38+
39+ - name : Check resolved package versions
40+ shell : bash
41+ if : |
42+ contains(fromJSON('[null, "", "undefined"]'), steps.resolve-package-versions.outputs.PLAYWRIGHT_VERSION)
43+ run : echo "Failed to resolve package versions. See log above." && exit 1
44+
45+ - name : Cache Playwright v${{ steps.resolve-package-versions.outputs.PLAYWRIGHT_VERSION }}
46+ uses : actions/cache@v4
47+ id : playwright-cache
48+ with :
49+ path : ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
50+ key : ${{ runner.os }}-playwright-${{ steps.resolve-package-versions.outputs.PLAYWRIGHT_VERSION }}
51+ restore-keys : |
52+ ${{ runner.os }}-playwright-
53+
2054 - uses : actions/cache@v4
2155 with :
2256 path : |
0 commit comments