diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index a0f619cb393..156da172ac7 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -8,6 +8,11 @@ concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true +env: + CACHE_KEY_PART: > + ${{ ( github.event_name == 'pull_request' ) && github.base_ref + }}${{ ( github.event_name == 'pull_request' ) && '-' }}${{ github.head_ref }} + GITHUB_JSON: ${{ toJSON(github) }} # Helps in debugging Github Action # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: # This workflow contains a single job @@ -41,8 +46,11 @@ jobs: uses: actions/cache/restore@v4 with: path: ./.github/tmp - key: "phpstan-cache-${{ matrix.php-version }}-${{ github.run_id }}" + key: phpstan-cache-${{ matrix.php-version }}-${{ env.CACHE_KEY_PART }}-${{ github.run_id }} restore-keys: | + phpstan-cache-${{ matrix.php-version }}-${{ env.CACHE_KEY_PART }}- + phpstan-cache-${{ matrix.php-version }}-${{ github.head_ref }}- + phpstan-cache-${{ matrix.php-version }}-${{ github.base_ref }}- phpstan-cache-${{ matrix.php-version }}- - name: Show debug into run: cd ./.github/tmp && ls -al @@ -59,4 +67,4 @@ jobs: if: ${{ success() || ( ! cancelled() && steps.cache.outputs.cache-hit != 'true' ) }} with: path: ./.github/tmp - key: "phpstan-cache-${{ matrix.php-version }}-${{ github.run_id }}" + key: phpstan-cache-${{ matrix.php-version }}-${{ env.CACHE_KEY_PART }}-${{ github.run_id }}