Documentation is unclear about `cache-hit`'s value when the cache misses.
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.6k
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
Description
In some places it is stated that cache-hit evaluates to the empty string when if fails, notably here:
- https://github.com/actions/cache/blob/main/README.md?plain=1#L86-L88
- Also here: https://github.com/actions/cache/issues/1466#issuecomment-2400480945 (I found this issue reading the code, more specifically here: https://github.com/actions/cache/blob/1bd1e32a3bdc45362d1e726936510720a7c30a57/src/restoreImpl.ts#L54-L55
However this would appear to contradict this other statement:
I am assuming that the latter is a mistake and the former is the intended behavior (mainly based on the comments of the issue linked above). Is this assumption correct or am I missing something?
Is there any specific moment in the codebase where the empty string is returned? I was not able to find it. Do note that I am not too familiar with typescript. AFAIK, it would seem that the only places where cache-hit is set are:
- https://github.com/actions/cache/blob/1bd1e32a3bdc45362d1e726936510720a7c30a57/src/restoreImpl.ts#L18
- Here it is set to false
- https://github.com/actions/cache/blob/1bd1e32a3bdc45362d1e726936510720a7c30a57/src/restoreImpl.ts#L79
- And here, the
isExactKeyMatchappears to return a boolean (based on its signature https://github.com/actions/cache/blob/main/src/utils/actionUtils.ts#L19).
- And here, the
Furthermore, are there any examples in how to handle the case when the cacheHit evaluates to the empty string? I could only find examples where that variable is tested for "true" or "false".
Thanks in advance!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the contradictory cache-hit statements in README.md, then inspect src/restoreImpl.ts and src/utils/actionUtils.ts to reconcile the documented behavior with the implementation. Check existing examples for handling the output values. Done means the README consistently explains the value on a cache miss and shows how to use it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions, typescript
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100