Open rikhuijzer opened 1 year ago
I also discovered this the hard way :rofl: It looks like there's https://github.com/actions/cache/pull/876 to correct the issue ?
Although it's true the documentation at https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#using-the-output-of-the-cache-action speaks only about true
, a consumer of the action might easily interpret that as just because that's the example that was chosen. Using true
brings along the implicit assumption that the negation of the precondition (no cache hit) will be false
. If it's not the case, then that probably deserves a special note in the documentation.
The
outputs.cache-hit
used to indicate that the value is a boolean, which meanstrue
orfalse
. However,outputs.cache-hit
is not set when there is no cache restored. I discovered this the hard way and also @aparna-ravindra mentioned it in https://github.com/github/docs/pull/18524#issuecomment-1161626882: