Skip to content

Commit 1ff88fd

Browse files
Boshenclaude
andcommitted
Only save Valgrind cache on main branch
Split the Valgrind cache step into two separate steps: - Save and restore on main branch - Restore only on PR branches This prevents cache pollution from PR branches while still allowing PRs to benefit from the cached Valgrind installation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent f78b396 commit 1ff88fd

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

action.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,24 @@ runs:
9393
tool: ${{ inputs.tools }}
9494

9595
# Cache valgrind and all its dependencies (20MB valgrind + 12MB dependencies)
96-
- name: Cache Valgrind and dependencies
96+
- name: Save and restore Valgrind cache on main
9797
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # 4.3.0
9898
id: cache-valgrind
99-
if: ${{ runner.os == 'Linux' && contains(inputs.tools, 'cargo-codspeed') }}
99+
if: ${{ runner.os == 'Linux' && contains(inputs.tools, 'cargo-codspeed') && github.ref_name == 'main' }}
100+
with:
101+
path: ~/valgrind-cache
102+
key: valgrind-3.24.0-codspeed-ubuntu-24.04-v1
103+
104+
- name: Restore Valgrind cache on PR
105+
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # 4.3.0
106+
id: cache-valgrind-restore
107+
if: ${{ runner.os == 'Linux' && contains(inputs.tools, 'cargo-codspeed') && github.ref_name != 'main' }}
100108
with:
101109
path: ~/valgrind-cache
102110
key: valgrind-3.24.0-codspeed-ubuntu-24.04-v1
103111

104112
- name: Download Valgrind and dependencies
105-
if: ${{ runner.os == 'Linux' && contains(inputs.tools, 'cargo-codspeed') && steps.cache-valgrind.outputs.cache-hit != 'true' }}
113+
if: ${{ runner.os == 'Linux' && contains(inputs.tools, 'cargo-codspeed') && steps.cache-valgrind.outputs.cache-hit != 'true' && steps.cache-valgrind-restore.outputs.cache-hit != 'true' }}
106114
shell: bash
107115
run: |
108116
mkdir -p ~/valgrind-cache

0 commit comments

Comments
 (0)