From d7225528971099e70991728e9ab0449c8a21f2ed Mon Sep 17 00:00:00 2001 From: Matthias Benkort <5680256+KtorZ@users.noreply.github.com> Date: Fri, 7 Mar 2025 11:04:57 +0100 Subject: [PATCH] Document `path` behaviour and access restrictions Thanks to this comment which saved me some headache: https://github.com/actions/cache/issues/1491#issuecomment-2450718907 related to #1561. related to #1491. related to #1426. --- caching-strategies.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/caching-strategies.md b/caching-strategies.md index a51d5f3..3357f26 100644 --- a/caching-strategies.md +++ b/caching-strategies.md @@ -165,6 +165,10 @@ steps: run: /publish.sh ``` +> [!IMPORTANT] +> +> The `path` must match on both the centralized job and the target job, otherwise there will be no cache-hit whatsoever. Also take notes of the [restrictions for accessing caches across workflows](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache). + ### Failing/Exiting the workflow if cache with exact key is not found You can use the output of this action to exit the workflow on cache miss. This way you can restrict your workflow to only initiate the build when `cache-hit` occurs, in other words, cache with exact key is found.