From e1db0e6a1a968dc9306f15e17a9aafbcc67b8fec Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Fri, 27 Jan 2023 17:13:21 +0100 Subject: [PATCH] 'cleanup caches' example workflow is wrong and harmful! It will delete the caches of the base branch, not the PR branch. Needs fixing! I added an alert in comments that this example doesn't work. --- .../caching-dependencies-to-speed-up-workflows.md | 4 ++++ 1 file changed, 4 insertions(+) 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 3fb5f8f03bc5..cea6569d1ace 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 @@ -345,6 +345,10 @@ jobs: REPO={% raw %}${{ github.repository }}{% endraw %} BRANCH={% raw %}${{ github.ref }}{% endraw %} + ## This is wrong!! + ## If invoked by a closing PR, BRANCH ends up to be the base branch, e.g. master. + ## This job will then remove exactly the wrong caches. + ## HARMFUL EXAMPLE, should be fixed immediately by some knowledgeable person. echo "Fetching list of cache key" cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 )