From 3e5c15c17253031c88111d15ff05007c349ba593 Mon Sep 17 00:00:00 2001 From: Nicholas Dudfield Date: Thu, 30 Oct 2025 09:25:21 +0700 Subject: [PATCH] fix(cache): handle empty cache gracefully in [ci-clear-cache] When [ci-clear-cache] is used but no cache exists yet, grep returns exit code 1 which causes script failure with set -e. Add || echo "0" to handle case where no deltas exist to delete. --- .github/actions/xahau-actions-cache-restore/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/xahau-actions-cache-restore/action.yml b/.github/actions/xahau-actions-cache-restore/action.yml index 712dae303..37daea123 100644 --- a/.github/actions/xahau-actions-cache-restore/action.yml +++ b/.github/actions/xahau-actions-cache-restore/action.yml @@ -106,7 +106,7 @@ runs: # Delete all delta layers for this key echo "Deleting all delta layers matching: ${CACHE_KEY}-delta-*" - DELTA_COUNT=$(aws s3 ls "s3://${S3_BUCKET}/" --region "${S3_REGION}" | grep "${CACHE_KEY}-delta-" | wc -l) + DELTA_COUNT=$(aws s3 ls "s3://${S3_BUCKET}/" --region "${S3_REGION}" | grep "${CACHE_KEY}-delta-" | wc -l || echo "0") if [ "${DELTA_COUNT}" -gt 0 ]; then aws s3 rm "s3://${S3_BUCKET}/" --recursive \ --exclude "*" \