diff --git a/.github/actions/setup-and-cache/action.yml b/.github/actions/setup-and-cache/action.yml index 9ab880d42..b5528ea38 100644 --- a/.github/actions/setup-and-cache/action.yml +++ b/.github/actions/setup-and-cache/action.yml @@ -26,15 +26,28 @@ runs: node -e " const fs = require('fs'); const lockfile = fs.readFileSync('./pnpm-lock.yaml', 'utf8'); - const cypressVersion = lockfile.match(/cypress: (\d+\.\d+\.\d+)/)[1]; - const playwrightVersion = lockfile.match(/playwright: (\d+\.\d+\.\d+)/)[1]; - const puppeteerVersion = lockfile.match(/puppeteer: (\d+\.\d+\.\d+)/)[1]; + const pattern = (name) => new RegExp(name + ':\\\s+specifier: [\\\s\\\w\\\.^]+version: (\\\d+\\\.\\\d+\\\.\\\d+)'); + const cypressVersion = lockfile.match(pattern('cypress'))[1]; + const playwrightVersion = lockfile.match(pattern('playwright'))[1]; + const puppeteerVersion = lockfile.match(pattern('puppeteer'))[1]; console.log('CYPRESS_VERSION=' + cypressVersion); console.log('PLAYWRIGHT_VERSION=' + playwrightVersion); console.log('PUPPETEER_VERSION=' + puppeteerVersion); " )" >> $GITHUB_OUTPUT + - name: Print versions + shell: bash + run: echo "${{ toJson(steps.resolve-package-versions.outputs) }}" + + - name: Check resolved package versions + shell: bash + if: | + contains(fromJSON('[null, "", "undefined"]'), steps.resolve-package-versions.outputs.CYPRESS_VERSION) || + contains(fromJSON('[null, "", "undefined"]'), steps.resolve-package-versions.outputs.PLAYWRIGHT_VERSION) || + contains(fromJSON('[null, "", "undefined"]'), steps.resolve-package-versions.outputs.PUPPETEER_VERSION) + run: echo "Failed to resolve package versions. See log above." && exit 1 + - name: Cache Cypress v${{ steps.resolve-package-versions.outputs.CYPRESS_VERSION }} uses: actions/cache@v3 id: cypress-cache