cache icon indicating copy to clipboard operation
cache copied to clipboard

Add cachePath as an output for easier access

Open llakala opened this issue 1 year ago • 0 comments

Description

I've updated the constants to expect cachePath to exist, and saved cachePath as the value set in the path input, unchanged. This is so it can be properly reused in the future. I've also updated all the tests to accommodate the changes, and updated the documentation.

Motivation and Context

Github Actions will only save caches if all tests pass. This is unhelpful is the result of a test doesn't equate to an invalid cache. The recommended aapproach to solve this is to use actions/cache/restore and actions/cache/save to separate the actions of saving and loading. However, this adds a point of common issues when it comes to ensuring the keys and paths are the same for both saving and loading. You'd likely do these at different times, so they'll be very split up. This makes it easy for the two to get desynced by accident. To help resolve this, cache-primary-key and cache-matched-key exist as outputs. This is very helpful, since you can just reuse those outputs for saving the cache. However, the same doesn't exist for the path. This implements that, so you can reuse the path and making your saving workflow simpler.

How Has This Been Tested?

I've updated all of the testing files to expect the changes, and they now all properly pass.

Types of changes

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [x] Documentation (add or update README or docs)

Checklist:

  • [x] My code follows the code style of this project.
  • [x] My change requires a change to the documentation.
  • [x] I have updated the documentation accordingly.
  • [x] I have read the CONTRIBUTING document.
  • [x] I have added tests to cover my changes.
  • [x] All new and existing tests passed.

llakala avatar Jul 19 '24 21:07 llakala