Document that no cache is saved on an exact match and thus file hashes should be included in keys
The (unexpected, to me) fact that the cache isn't updated on an exact match seems to be an important point worthy of being documented, and it helps to explain exactly why hash expressions should be included in keys.
@jwodder All our recommended workflows have hash of the files included. Like package.json or requirements.txt. So I suppose this PR is no longer needed.
@Phantsure I don't think that makes a difference. Just having exact file hashes in all of the recommended workflows isn't enough to explain why they should be there.
Exact match of the key means cache hit. When a cache hit occurs, cache wouldn't be updated as cache is already present there. When a cache miss occurs, cache will be updated for future use. It seems you are suggesting that users might not be familiar with concept of caching. Is that right?
@Phantsure I'm suggesting they might not be familiar with the "When a cache hit occurs, cache wouldn't be updated" aspect of caching, yes.
cc @vsvipul For second par of eyes. Does this change makes sense here or should it be present at all?
You are suggesting to call out two things:
- Cache is not saved on cache hit
- Use hash of dependency files in key, so as to invalidate cache when files change.
@jwodder Is that right?
@Phantsure Yes.
- cache not saved on hit, read below example workflow: https://github.com/actions/cache#example-workflow
- Use hashfiles: https://github.com/actions/cache#creating-a-cache-key
All seems resolved, So I am closing this PR. Thank you for your contribution @jwodder