CI: restore main's Rust cache in fork pull request jobs on the untrusted runners (#2254)
Fork pull requests now run on the untrusted self-hosted runners, which start every job empty. Let them restore main's rust-cache like GitHub's runners do (save-if stays main only, so a fork job never writes a cache). Co-authored-by: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
5c95b0496d
commit
a33c5a7861
1 file changed
+12
-8
@@ -186,8 +186,9 @@ jobs:
|
|||||||
- uses: dtolnay/rust-toolchain@stable
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
with:
|
with:
|
||||||
components: rustfmt
|
components: rustfmt
|
||||||
# The self-hosted runner keeps its build directory and Cargo home instead.
|
# The trusted self-hosted runners keep their build directory and Cargo home instead; the
|
||||||
- if: runner.environment == 'github-hosted'
|
# untrusted ones (fork pull requests) start empty and restore main's cache, read-only.
|
||||||
|
- if: runner.environment == 'github-hosted' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository)
|
||||||
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
|
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
|
||||||
with:
|
with:
|
||||||
key: repo-checks
|
key: repo-checks
|
||||||
@@ -227,8 +228,9 @@ jobs:
|
|||||||
- uses: dtolnay/rust-toolchain@stable
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
with:
|
with:
|
||||||
components: clippy
|
components: clippy
|
||||||
# The self-hosted runner keeps its build directory and Cargo home instead.
|
# The trusted self-hosted runners keep their build directory and Cargo home instead; the
|
||||||
- if: runner.environment == 'github-hosted'
|
# untrusted ones (fork pull requests) start empty and restore main's cache, read-only.
|
||||||
|
- if: runner.environment == 'github-hosted' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository)
|
||||||
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
|
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
|
||||||
with:
|
with:
|
||||||
key: native-clippy
|
key: native-clippy
|
||||||
@@ -451,8 +453,9 @@ jobs:
|
|||||||
if: runner.environment == 'self-hosted' && !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository)
|
if: runner.environment == 'self-hosted' && !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository)
|
||||||
run: scripts/ci/warm-target.sh doc-tests
|
run: scripts/ci/warm-target.sh doc-tests
|
||||||
- uses: dtolnay/rust-toolchain@stable
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
# The self-hosted runner keeps its build directory and Cargo home instead.
|
# The trusted self-hosted runners keep their build directory and Cargo home instead; the
|
||||||
- if: runner.environment == 'github-hosted'
|
# untrusted ones (fork pull requests) start empty and restore main's cache, read-only.
|
||||||
|
- if: runner.environment == 'github-hosted' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository)
|
||||||
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
|
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
|
||||||
with:
|
with:
|
||||||
key: doc-tests
|
key: doc-tests
|
||||||
@@ -501,8 +504,9 @@ jobs:
|
|||||||
if: runner.environment == 'self-hosted' && !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository)
|
if: runner.environment == 'self-hosted' && !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository)
|
||||||
run: scripts/ci/warm-target.sh oracle
|
run: scripts/ci/warm-target.sh oracle
|
||||||
- uses: dtolnay/rust-toolchain@stable
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
# The self-hosted runner keeps its build directory and Cargo home instead.
|
# The trusted self-hosted runners keep their build directory and Cargo home instead; the
|
||||||
- if: runner.environment == 'github-hosted'
|
# untrusted ones (fork pull requests) start empty and restore main's cache, read-only.
|
||||||
|
- if: runner.environment == 'github-hosted' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository)
|
||||||
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
|
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
|
||||||
with:
|
with:
|
||||||
key: oracle
|
key: oracle
|
||||||
|
|||||||
Reference in new issue
Block a user