From 3b403a3c6e8601fe67a0d95d2e2fe3e40a0b6477 Mon Sep 17 00:00:00 2001 From: Mikhail Ryzhov Date: Thu, 14 Sep 2023 14:11:14 +0200 Subject: [PATCH] exclude empty --- .github/workflows/cleanup_cache.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cleanup_cache.yml b/.github/workflows/cleanup_cache.yml index 40adb34e5dc5e2..bc06759639a50d 100644 --- a/.github/workflows/cleanup_cache.yml +++ b/.github/workflows/cleanup_cache.yml @@ -46,12 +46,14 @@ jobs: echo "${cacheKeysForPRSliced[@]}" ## Setting this to not fail the workflow while deleting cache keys. set +e - echo "Deleting caches..." - for cacheKey in ${cacheKeysForPRSliced[@]} - do - # gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm - echo "${cacheKey}" - done + if "${#ArrayName[@]}" -gt "0"; then + echo "Deleting caches..." + for cacheKey in ${cacheKeysForPRSliced[@]} + do + # gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm + echo "${cacheKey}" + done + fi done echo "Done"