You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Notecache-hit will only be set to true when a cache hit occurs for the exact key match. For a partial key match via restore-keys or a cache miss, it will be set to false.
but outputs.cache-hit == 'false' doesn't seem to be true when I get a cache miss, and I noticed that the examples all use != 'true', not == 'false'.
I think here we can see restoreImpl return early on a miss, without setting any value for cache-hit at all. I'm not a TypeScript or Actions expert though.
In the meantime, I'll switch my == 'false' to != 'true' but I feel dirty. :)
Reacted by Takuya Fukuju, Tymon Żarski, Shoma Kokuryo, Futa HIRAKOBA, azu, Miyata Jumpei, Hideki Igarashi, Taku Kodama and Kenta Kase
This problem does not seem to occur in v3, only in v4. In fact, the repositories that had been delayed updating to v4 were working fine.
In workflows that saving the cache when outputs.cache-hit == 'false', the cache was no longer being saved. I recognized this too late because it simply skips a step and does not result in an error.
Is this a bug? Or is it a breaking change?
@RalfJung: I was going to say don't use if: ${{ steps.cache.outputs.cache-hit != 'true' }} because that's a string that will always evaluate to true, not a boolean expression, and that you should use if: steps.cache.outputs.cache-hit != 'true' instead.
But if it eventually worked for you, then I have no idea how anything works.
Activity
yaml: work around actions/cache#1334
pddg commentedon Apr 16, 2024
This problem does not seem to occur in v3, only in v4. In fact, the repositories that had been delayed updating to v4 were working fine.
In workflows that saving the cache when
outputs.cache-hit == 'false', the cache was no longer being saved. I recognized this too late because it simply skips a step and does not result in an error.Is this a bug? Or is it a breaking change?
RalfJung commentedon May 3, 2024
aryairani commentedon May 3, 2024
@RalfJung: I was going to say don't use
if: ${{ steps.cache.outputs.cache-hit != 'true' }}because that's a string that will always evaluate totrue, not a boolean expression, and that you should useif: steps.cache.outputs.cache-hit != 'true'instead.But if it eventually worked for you, then I have no idea how anything works.
no-yan commentedon May 4, 2024
It looks like there are document revisions in progress related to this issue.
#1263
joshmgross commentedon Oct 8, 2024
This is being reverted in #1467 as workflows are already dependent on
cache-hitbeing undefined - #1466