Documentation is unclear about `cache-hit`'s value when the cache misses.
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:
- https://github.com/actions/cache/blob/main/README.md?plain=1#L129
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!
Btw, I have opened a PR to update the documentation to reflect this behavior: #1514