Skip to content

SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.

CI: restore main's Rust cache in fork pull request jobs on the untrusted runners (#2254)

bherbrucka33c5a7861fc
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index cc43355888..8894f3b59c 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -186,8 +186,9 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- # The self-hosted runner keeps its build directory and Cargo home instead.
- - if: runner.environment == 'github-hosted'
+ # The trusted self-hosted runners keep their build directory and Cargo home instead; the
+ # 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
with:
key: repo-checks
@@ -227,8 +228,9 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- # The self-hosted runner keeps its build directory and Cargo home instead.
- - if: runner.environment == 'github-hosted'
+ # The trusted self-hosted runners keep their build directory and Cargo home instead; the
+ # 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
with:
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)
run: scripts/ci/warm-target.sh doc-tests
- uses: dtolnay/rust-toolchain@stable
- # The self-hosted runner keeps its build directory and Cargo home instead.
- - if: runner.environment == 'github-hosted'
+ # The trusted self-hosted runners keep their build directory and Cargo home instead; the
+ # 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
with:
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)
run: scripts/ci/warm-target.sh oracle
- uses: dtolnay/rust-toolchain@stable
- # The self-hosted runner keeps its build directory and Cargo home instead.
- - if: runner.environment == 'github-hosted'
+ # The trusted self-hosted runners keep their build directory and Cargo home instead; the
+ # 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
with:
key: oracle