Parcourir la source

Only attempt cache deletion if exists (#26124)

Joel Challis il y a 4 mois
Parent
commit
e4b998ccb0
1 fichiers modifiés avec 5 ajouts et 1 suppressions
  1. 5 1
      .github/workflows/ci_build_major_branch_keymap.yml

+ 5 - 1
.github/workflows/ci_build_major_branch_keymap.yml

@@ -129,7 +129,11 @@ jobs:
         env:
           GH_TOKEN: ${{ github.token }}
         if: steps.cache.outputs.cache-hit
-        run: gh cache delete --ref ${{ github.ref }} ${{ steps.cache.outputs.cache-primary-key }}
+        run: |
+          count=$(gh cache list --ref ${{ github.ref }} ${{ steps.cache.outputs.cache-primary-key }} --json id | jq length)
+          if [ $count -gt 0 ]; then
+            gh cache delete --ref ${{ github.ref }} ${{ steps.cache.outputs.cache-primary-key }}
+          fi
 
       - name: Save Cache
         uses: actions/cache/save@v5