From 8fc291c114672184fd2ffd272b7a0252c8e6984d Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Tue, 17 Oct 2023 22:36:00 +0200 Subject: [PATCH] README: clarify that `cache-hit` returns a string and not a boolean 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 #1262. --- README.md | 4 ++-- restore/README.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d1d2aef..d515fa2 100644 --- a/README.md +++ b/README.md @@ -65,9 +65,9 @@ If you are using a `self-hosted` Windows runner, `GNU tar` and `zstd` are requir ### Outputs -* `cache-hit` - A boolean value to indicate an exact match was found for the key. +* `cache-hit` - A string `'true'` or `'false'` indicating whether an exact match was found for the key. - > **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'`. See [Skipping steps based on cache-hit](#skipping-steps-based-on-cache-hit) for info on using this output diff --git a/restore/README.md b/restore/README.md index a7203e9..272af2d 100644 --- a/restore/README.md +++ b/restore/README.md @@ -14,12 +14,12 @@ The restore action restores a cache. It works similarly to the `cache` action ex ### Outputs -* `cache-hit` - A boolean value to indicate an exact match was found for the key. +* `cache-hit` - A string `'true'` or `'false'` to indicate whether an exact match was found for the key. * `cache-primary-key` - Cache primary key passed in the input to use in subsequent steps of the workflow. * `cache-matched-key` - Key of the cache that was restored, it could either be the primary key on cache-hit or a partial/complete match of one of the restore keys. > **Note** -`cache-hit` will be set to `true` only when 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`. +`cache-hit` will be set to `'true'` only when 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'`. ### Environment Variables