Skip to content

Commit 3148024

Browse files
authored
Only save cache if running on main (#7460)
1 parent f276598 commit 3148024

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

.github/workflows/ci.yaml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ jobs:
4848
- uses: dtolnay/rust-toolchain@stable
4949
with:
5050
components: clippy
51-
- uses: Swatinem/rust-cache@v2
51+
52+
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
53+
with:
54+
save-if: ${{ github.ref == 'refs/heads/main' }}
5255

5356
- name: Install macOS dependencies
5457
uses: ./.github/actions/install-macos-deps
@@ -131,9 +134,10 @@ jobs:
131134
with:
132135
persist-credentials: false
133136

134-
- uses: Swatinem/rust-cache@v2
137+
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
135138
with:
136139
prefix-key: v0-rust-${{ join(matrix.targets, '-') }}
140+
save-if: ${{ github.ref == 'refs/heads/main' }}
137141

138142
- name: Install dependencies
139143
uses: ./.github/actions/install-linux-deps
@@ -280,7 +284,9 @@ jobs:
280284

281285
- uses: dtolnay/rust-toolchain@stable
282286

283-
- uses: Swatinem/rust-cache@v2
287+
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
288+
with:
289+
save-if: ${{ github.ref == 'refs/heads/main' }}
284290

285291
- uses: actions/setup-python@v6.2.0
286292
with:
@@ -436,7 +442,9 @@ jobs:
436442
toolchain: ${{ env.NIGHTLY_CHANNEL }}
437443
components: miri
438444

439-
- uses: Swatinem/rust-cache@v2
445+
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
446+
with:
447+
save-if: ${{ github.ref == 'refs/heads/main' }}
440448

441449
- name: Run tests under miri
442450
run: cargo +${{ env.NIGHTLY_CHANNEL }} miri test -p rustpython-vm -- miri_test
@@ -457,7 +465,10 @@ jobs:
457465

458466
- uses: dtolnay/rust-toolchain@stable
459467

460-
- uses: Swatinem/rust-cache@v2
468+
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
469+
with:
470+
save-if: ${{ github.ref == 'refs/heads/main' }}
471+
461472
- name: install wasm-pack
462473
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
463474
- name: install geckodriver
@@ -525,7 +536,10 @@ jobs:
525536
with:
526537
target: wasm32-wasip1
527538

528-
- uses: Swatinem/rust-cache@v2
539+
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
540+
with:
541+
save-if: ${{ github.ref == 'refs/heads/main' }}
542+
529543
- name: Setup Wasmer
530544
uses: wasmerio/setup-wasmer@v3
531545

0 commit comments

Comments
 (0)