Add cachePath as an output for easier access #1436
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Checklist: