diff --git a/.github/actions/setup-node/action.yml b/.github/actions/setup-node/action.yml index 65777a99305b45..09108b4c65bbe0 100644 --- a/.github/actions/setup-node/action.yml +++ b/.github/actions/setup-node/action.yml @@ -47,6 +47,11 @@ runs: (steps.node-modules-restore.outputs.cache-hit == 'true') && 'true' || '' }}' >> "$GITHUB_ENV" + - name: Calculate `PNPM_STORE` + shell: bash + run: | + echo "PNPM_STORE=$(pnpm store path)" >> "$GITHUB_ENV" + - name: Setup pnpm uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 with: @@ -56,7 +61,21 @@ runs: uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 with: node-version: ${{ inputs.node-version }} - cache: ${{ env.CACHE_HIT != 'true' && 'pnpm' || '' }} + + - name: Cache and restore `pnpm store` + if: env.CACHE_HIT != 'true' + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 + with: + path: ${{ env.PNPM_STORE }} + key: | + pnpm_store-${{ + inputs.os + }}-${{ + inputs.node-version + }}-${{ + hashFiles('pnpm-lock.yaml', 'package.json') + }} + enableCrossOsArchive: true - name: Install dependencies uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0