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: Cache-Hit set to string, not boolean, as of v4.1.0 #1466 (comment) (I found this issue reading the code, more specifically here:
Lines 54 to 55 in 1bd1e32
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:
Line 18 in 1bd1e32
- Here it is set to false
Line 79 in 1bd1e32
- And here, the
isExactKeyMatch
appears 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!
Activity
Clarify that the empty string is returned if no cache is restored.
README.md: Clarify that the empty string is returned if no cache is r…
lima-limon-inc commentedon Apr 16, 2025
Btw, I have opened a PR to update the documentation to reflect this behavior: #1514