From b87fdd5da4b36adf6d09d600c103baaec00f3548 Mon Sep 17 00:00:00 2001 From: silverwind Date: Sun, 2 Aug 2026 14:57:37 +0200 Subject: [PATCH] ci: fix `jq` broken pipe in cache-prune (#38734) Fix minor issue: `cache-prune` logs `jq: error: writing output failed: Broken pipe` when it has nothing to delete, because the loop stops reading as soon as it is under the limit while `jq` still has output pending. Reading from a here-string removes the pipe. --------- Signed-off-by: silverwind --- .github/workflows/cache-prune.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cache-prune.yml b/.github/workflows/cache-prune.yml index 847603e7fd..db22d234c6 100644 --- a/.github/workflows/cache-prune.yml +++ b/.github/workflows/cache-prune.yml @@ -30,9 +30,8 @@ jobs: caches=$(gh cache list --limit 1000 --sort last_accessed_at --order asc --json id,key,sizeInBytes) size=$(jq '[.[].sizeInBytes] | add // 0' <<< "$caches") echo "cache usage: $((size / 1000000)) MB" - jq -r '.[] | "\(.id) \(.sizeInBytes) \(.key)"' <<< "$caches" | - while [ "$size" -gt 6500000000 ] && read -r id bytes key; do - echo "deleting $key" - gh cache delete "$id" - size=$((size - bytes)) - done + while [ "$size" -gt 6500000000 ] && read -r id bytes key; do + echo "deleting $key" + gh cache delete "$id" + size=$((size - bytes)) + done <<< "$(jq -r '.[] | "\(.id) \(.sizeInBytes) \(.key)"' <<< "$caches")"