Originally created by: Akarsh-Hegde
Adds save-if to all three Swatinem/rust-cache@v2 steps in ci.yml (rust, windows-portability, macos-universal):
save-if: ${{ github.ref == 'refs/heads/pre-main' || github.ref == 'refs/heads/main' }}
PR runs keep restoring — GitHub lets a PR run read caches from its base branch — they just stop writing a duplicate.
Actions caches are scoped by ref. A branch that is both pushed to pre-main and has an open PR therefore stores two near-identical copies of every target/ cache. Measured 2026-07-19:
| Cache | pre-main | pull/483/merge |
|---|---|---|
macos-universal |
2582 MB | 2527 MB |
windows-portability |
1269 MB | 1262 MB |
rust (Linux) |
1091 MB | 851 MB |
9.58 GB against a 10 GB per-repo quota, from six entries all created inside one 15-minute window. GitHub evicted LRU to stay under, and the casualty was the release job's own 2618 MB cache — written at 13:42, gone by ~16:55. Release run 29696118671 consequently compiled fully cold.
This frees ~4.9 GB (12.18 GB → ~7.3 GB).
cache-targets: falseThat was the other candidate and it's the worse trade. Those jobs are already the slowest in CI with a warm cache — on run 29695608454: Windows portability 8.1 min, macOS 6.2 min, Rust 2.3 min. Dropping target/ would add ~10 min to every PR to save ~20 min on an infrequent release.
pre-main that refreshes the release-namespace cache, or more quota. Neither is in this PR.save-if is confirmed present in action.yml at the pinned SHA (e18b497). The effect is only observable across runs — after merge, the check is that PR runs stop appearing as pull/* refs in gh cache list while still logging a restore.
Originally posted by: coderabbitai[bot]
✨ Finishing Touches
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests - [ ] Commit unit tests in branch `ci/scope-rust-cache-saves`Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)Comment
@coderabbitai helpto get the list of available commands.Ticket changed by: Akarsh-Hegde