Use branch name for DVC cache key#9
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the composite GitHub Action’s DVC caching strategy to key caches by branch name (with a fallback restore from the repository default branch), to improve cache reuse and address the linked caching issue.
Changes:
- Restore DVC cache using a branch-based key, and add a second restore attempt from the default branch on branch-cache miss.
- Save DVC cache using the branch-based key.
- Document the branch-based cache restore/save behavior in the README.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
action.yml |
Switches DVC cache keys from commit SHA to branch name and adds a default-branch restore fallback. |
README.md |
Documents the updated branch-based caching and fallback behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| restore-keys: | | ||
| ${{ runner.os }}-dvc-cache- | ||
| ${{ runner.os }}-dvc-cache-${{ github.head_ref || github.ref_name }}- | ||
| ${{ runner.os }}-dvc-cache-${{ github.event.repository.default_branch }}- |
There was a problem hiding this comment.
Changing the cache key format means existing caches created by earlier versions (e.g., ${{ runner.os }}-dvc-cache-${{ github.sha }}) won’t be considered by restore-keys, which can cause a cold-cache slowdown right after upgrading the action. Consider adding the previous ${{ runner.os }}-dvc-cache- prefix as a last restore fallback (after the branch + default branch entries) to preserve cache hits during the transition.
| ${{ runner.os }}-dvc-cache-${{ github.event.repository.default_branch }}- | |
| ${{ runner.os }}-dvc-cache-${{ github.event.repository.default_branch }}- | |
| ${{ runner.os }}-dvc-cache- |
Should help with calkit/calkit#837