From 5ef92b9ab80c89252e437285c1dd4e3f75a32f67 Mon Sep 17 00:00:00 2001 From: Richard McDaniel <1130888+rmcdaniel@users.noreply.github.com> Date: Sun, 1 Nov 2026 21:23:08 +0000 Subject: [PATCH] Rust #325: skip cache restores on fork pull requests A fork pull request's merge ref could restore a cache entry the same fork wrote, so the six cache restore steps in PHPUnit Feature and Shared Server fixtures now run only for same-repository events. A skipped restore reads as a cache miss, so fork runs rebuild from source. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/phpunit-feature.yml | 1 + .github/workflows/server-parity.yml | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/phpunit-feature.yml b/.github/workflows/phpunit-feature.yml index 7ceeb6627..75a665f54 100644 --- a/.github/workflows/phpunit-feature.yml +++ b/.github/workflows/phpunit-feature.yml @@ -182,6 +182,7 @@ jobs: run: echo "key=server-php-tools-v2-${{ runner.os }}-${{ runner.arch }}-$(date -u +%Y%m%d)-${{ hashFiles('Dockerfile', 'Dockerfile.dockerignore', '.dockerignore', 'docker/**') }}" >> "$GITHUB_OUTPUT" - name: Restore the source-free PHP tool images + if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }} id: php_tools_cache uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: diff --git a/.github/workflows/server-parity.yml b/.github/workflows/server-parity.yml index 54eaaa326..27703d428 100644 --- a/.github/workflows/server-parity.yml +++ b/.github/workflows/server-parity.yml @@ -203,6 +203,7 @@ jobs: printf 'name=native-debug-build-%s-%s\nattempt=%s\n' \ "$GITHUB_RUN_ID" "$GITHUB_RUN_ATTEMPT" "$GITHUB_RUN_ATTEMPT" >> "$GITHUB_OUTPUT" - name: Restore native Cargo dependencies from trusted main + if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }} uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: | @@ -269,6 +270,7 @@ jobs: id: adapter_key run: bash scripts/ci/sdk-adapter-cache-key.sh - name: Restore the adapters' Cargo registry and build tree + if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }} id: adapter_cargo uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: @@ -590,6 +592,7 @@ jobs: # Exact dependency keys include the actual compiler pin, Cargo configuration # and vendored crates. Server outputs are discarded before rebuilding. - name: Restore native Cargo dependencies from trusted main + if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }} id: native_cargo uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: @@ -1316,6 +1319,7 @@ jobs: # Exact dependency keys include the actual compiler pin, Cargo configuration # and vendored crates. Server outputs are discarded before rebuilding. - name: Restore native Cargo dependencies from trusted main + if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }} id: native_cargo uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: @@ -2082,6 +2086,7 @@ jobs: # Exact dependency keys include the actual compiler pin, Cargo configuration # and vendored crates. Server outputs are discarded before rebuilding. - name: Restore native Cargo dependencies from trusted main + if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }} id: native_cargo uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: