From 512910892a6d51a252aa4416ab08dacb6ffeaa6b Mon Sep 17 00:00:00 2001 From: Stephen Schneider Date: Tue, 16 Aug 2022 21:40:37 -0700 Subject: [PATCH] Fixed method for checking cache-hit/miss (#18524) Co-authored-by: Lucas Costi --- .../caching-dependencies-to-speed-up-workflows.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/actions/using-workflows/caching-dependencies-to-speed-up-workflows.md b/content/actions/using-workflows/caching-dependencies-to-speed-up-workflows.md index e35ea2aac1..f636895b40 100644 --- a/content/actions/using-workflows/caching-dependencies-to-speed-up-workflows.md +++ b/content/actions/using-workflows/caching-dependencies-to-speed-up-workflows.md @@ -121,7 +121,7 @@ jobs: {% raw %}${{ runner.os }}-build-{% endraw %} {% raw %}${{ runner.os }}-{% endraw %} - - if: {% raw %}${{ steps.cache-npm.outputs.cache-hit == 'false' }}{% endraw %} + - if: {% raw %}${{ steps.cache-npm.outputs.cache-hit != 'true' }}{% endraw %} name: List the state of node modules continue-on-error: true run: npm list @@ -172,12 +172,12 @@ npm-d5ea0750 ### Using the output of the `cache` action -You can use the output of the `cache` action to do something based on whether a cache hit or miss occurred. If there is a cache miss (an exact match for a cache was not found for the specified `key`), the `cache-hit` output is set to `false`. +You can use the output of the `cache` action to do something based on whether a cache hit or miss occurred. When an exact match is found for a cache for the specified `key`, the `cache-hit` output is set to `true`. In the example workflow above, there is a step that lists the state of the Node modules if a cache miss occurred: ```yaml -- if: {% raw %}${{ steps.cache-npm.outputs.cache-hit == 'false' }}{% endraw %} +- if: {% raw %}${{ steps.cache-npm.outputs.cache-hit != 'true' }}{% endraw %} name: List the state of node modules continue-on-error: true run: npm list