Skip to content

Do not save cache after cache hit#4

Closed
hwellmann wants to merge 3 commits into
danySam:mainfrom
northdata:do-not-save-on-cache-hit
Closed

Do not save cache after cache hit#4
hwellmann wants to merge 3 commits into
danySam:mainfrom
northdata:do-not-save-on-cache-hit

Conversation

@hwellmann

Copy link
Copy Markdown

Description

When the cache is restored from the primary key, it gets saved at the end of the workflow.

This is not expected. There is no need to update the cache.

The cause is that the GCS path gets mixed up with the cache key, so that the cache-hit output is never set to true.

How Has This Been Tested?

Added jest tests that do not mock gcsCache.ts.
Ran this modified action in production and verified that the cache no longer get saved after a hit.

@hwellmann hwellmann requested a review from danySam as a code owner February 12, 2026 15:52
@danySam

danySam commented May 31, 2026

Copy link
Copy Markdown
Owner

Hey @hwellmann, thanks for identifying this bug and putting together the fix with tests! 🙏

I've incorporated your fix into PR #3 (commit 439b3a7) since both PRs touched the same code paths and needed to be combined. Your approach of separating cacheKey from gcsPath in the return type was exactly the right call. I used the CacheHitResult pattern and credited you via Co-authored-by.

Closing this in favor of #3, which now addresses both the prefix matching and the cache-hit issues. Thanks again for the contribution!

@danySam danySam closed this May 31, 2026
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