Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ability to restore cache by exact match #60

Merged
merged 1 commit into from
Aug 9, 2024

Conversation

szymonmaszke
Copy link
Contributor

@szymonmaszke szymonmaszke commented Aug 8, 2024

Closes #57 #43

Overview

  • Added new input for the action cache-restore-exact-match (default: 'false') - if 'true', will restore cache ONLY when the primary-key matches
  • Added relevant logic changes to .js files and regenerated dist.js via pnpm run build

Now it should be possible to create workflows as outlined in #57 and #43:

  • Create multiple caches (with a subset of dependencies) in the main branch (via GH Actions matrix strategy or similar)
  • Reuse this cache in PRs

Previously secondary restore-key would match even if the hashed dependency paths did not match.

Tests

  • No new tests implemented (default behavior should not change)
  • New tests might be necessary due to different cache restoration if cache-restore-exact-match: true, though I am not sure what the maintainers approach would be

Let me know if you would like any additional changes (keep in mind I'm not JS dev though)

EDIT: FWIW tested cache-restore-exact-match: true in one of my private repos and works as intended

Signed-off-by: szymonmaszke <github@maszke.co>
@frostming frostming linked an issue Aug 9, 2024 that may be closed by this pull request
@frostming frostming merged commit 2f3a9be into pdm-project:main Aug 9, 2024
15 checks passed
@szymonmaszke szymonmaszke deleted the issues/57 branch August 9, 2024 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants