-
Notifications
You must be signed in to change notification settings - Fork 1.3k
README: clarify that cache-hit
returns a string and not a boolean
#1263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@bethanyj28 : Anything left to do here? |
README.md
Outdated
|
||
> **Note** `cache-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`. | ||
> **Note** `cache-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'`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still incorrect. On a cache miss, the output is not set, i.e. empty string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@itchyny So you are saying it is three-valued, 'true'
, 'false'
or empty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andreasabel Exactly. A bit surprising behavior though. See https://github.com/itchyny/actions-cache-issues-1263/actions/runs/8385497449.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the thorough investigation @itchyny ! I updated the text accordingly.
Rationale: if `cache-hit` was a boolean, then `!` could be used to get the opposite. However, it is really a string, and this should be pointed out clearly in the documentation. Because both `!'true'` and `!'false'` are `false`, so customers can shoot themselves in the foot here. Closes actions#1262.
6710a4f
to
3182ee5
Compare
👋 Hey @andreasabel thank you for these changes! I'm updating the README to reflect this behavior as part of a bug fix in #1467 |
Rationale: if
cache-hit
was a boolean, then!
could be used to get the opposite.However, it is really a string, and this should be pointed out clearly in the documentation.
Because both
!'true'
and!'false'
arefalse
, so customers can shoot themselves in the foot here.Closes #1262.