Skip to content

Commit 37d7b8a

Browse files
committed
CI: Save cache only on main branch
With the size of the cache close to 1GB, we only want to save the cache for the `main` branch to avoid PRs and other branches removing the `main` branch cache because GitHub drops it due to total cache size reasons.
1 parent b0ec155 commit 37d7b8a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ jobs:
106106
- run: rustup component add clippy
107107

108108
- uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7
109+
with:
110+
save-if: ${{ github.ref == 'refs/heads/main' }}
109111

110112
- run: cargo fmt --check --all
111113
- run: cargo clippy --all-targets --all-features --workspace
@@ -133,6 +135,8 @@ jobs:
133135
persist-credentials: false
134136

135137
- uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7
138+
with:
139+
save-if: ${{ github.ref == 'refs/heads/main' }}
136140

137141
- run: cargo install cargo-deny --vers ${CARGO_DENY_VERSION}
138142
- run: cargo deny check
@@ -161,6 +165,8 @@ jobs:
161165
- run: sudo rm -rf /usr/local/lib/android
162166

163167
- uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7
168+
with:
169+
save-if: ${{ github.ref == 'refs/heads/main' }}
164170

165171
# Update `pg_dump` to the same version as the running PostgreSQL server
166172
- run: sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -v ${POSTGRES_VERSION} -i -p

0 commit comments

Comments
 (0)