Skip to content

Commit 3a99217

Browse files
committed
Coverage CI: gate OPAM cache save to master pushes (codex P2)
actions/cache/save@v5 on cache miss runs on every event including pull_request, which creates PR-scoped cache entries tied to refs/pull/<n>/merge. Those entries aren't restorable by master or other PRs, so they consume storage and can evict the shared master-saved entry, reducing hit rate. Restrict the save to push events on refs/heads/master, matching the pattern already used for the coverage-build-state cache. PRs still benefit from full restore via the latest master cache; they just don't write new entries. Flagged by Codex review on #8434.
1 parent 84b1662 commit 3a99217

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

.github/workflows/coverage.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,12 @@ jobs:
118118
if: steps.cache-opam-env.outputs.cache-hit != 'true'
119119
run: opam install . --deps-only --with-test --with-dev-setup
120120

121+
# Only save on master pushes. PR-scoped caches are tied to
122+
# refs/pull/<n>/merge and can't be restored by master or other PRs,
123+
# so they'd just consume storage and evict the shared entry. PRs
124+
# still get full restore from the latest master-saved cache.
121125
- name: Save OPAM environment
122-
if: steps.cache-opam-env.outputs.cache-hit != 'true'
126+
if: steps.cache-opam-env.outputs.cache-hit != 'true' && github.event_name == 'push' && github.ref == 'refs/heads/master'
123127
uses: actions/cache/save@v5
124128
with:
125129
path: |

0 commit comments

Comments
 (0)