From e4b998ccb00b7983e2fefefa749431beea4a04c6 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Thu, 2 Apr 2026 06:00:00 +0100 Subject: [PATCH] Only attempt cache deletion if exists (#26124) --- .github/workflows/ci_build_major_branch_keymap.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_build_major_branch_keymap.yml b/.github/workflows/ci_build_major_branch_keymap.yml index d3cef2a6fac..c683e5a94de 100644 --- a/.github/workflows/ci_build_major_branch_keymap.yml +++ b/.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