Skip to content

Use branch name for DVC cache key#9

Merged
petebachant merged 2 commits into
mainfrom
branch-cache
Apr 26, 2026
Merged

Use branch name for DVC cache key#9
petebachant merged 2 commits into
mainfrom
branch-cache

Conversation

@petebachant

Copy link
Copy Markdown
Member

Should help with calkit/calkit#837

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread action.yml Outdated
Comment thread README.md Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread action.yml
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 }}-

Copilot AI Apr 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
${{ runner.os }}-dvc-cache-${{ github.event.repository.default_branch }}-
${{ runner.os }}-dvc-cache-${{ github.event.repository.default_branch }}-
${{ runner.os }}-dvc-cache-

Copilot uses AI. Check for mistakes.
@petebachant petebachant merged commit 9afedf9 into main Apr 26, 2026
5 checks passed
@petebachant petebachant deleted the branch-cache branch April 26, 2026 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants