From 456be581aae79d0aed1f72ee3bee1126180d0627 Mon Sep 17 00:00:00 2001 From: Duncan Murchison Date: Tue, 6 Jan 2026 12:55:14 -0500 Subject: [PATCH] feat: improve workflow cleanup script to provide detailed deletion feedback and handle errors --- deployment/cleanup_workflows.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/deployment/cleanup_workflows.sh b/deployment/cleanup_workflows.sh index 9c72474..6b2b37d 100755 --- a/deployment/cleanup_workflows.sh +++ b/deployment/cleanup_workflows.sh @@ -135,18 +135,21 @@ for workflow_file in $WORKFLOW_FILES; do to_delete=$(echo "$run_ids" | tail -n +$((KEEP_RUNS + 1))) deleted=0 - echo "$to_delete" | while read -r run_id; do + while IFS= read -r run_id; do if [ -n "$run_id" ]; then - if gh run delete "$run_id" --yes 2>/dev/null; then + echo " Deleting run $run_id..." + if gh run delete "$run_id" --yes 2>&1; then ((deleted++)) || true + else + echo " Failed to delete run $run_id" fi fi - done + done <<< "$to_delete" - TOTAL_DELETED=$((TOTAL_DELETED + to_delete_count)) + TOTAL_DELETED=$((TOTAL_DELETED + deleted)) TOTAL_KEPT=$((TOTAL_KEPT + KEEP_RUNS)) - echo -e " ${GREEN}✓ Cleanup complete${NC}" + echo -e " ${GREEN}✓ Deleted $deleted runs${NC}" else echo " No cleanup needed (under retention limit)" TOTAL_KEPT=$((TOTAL_KEPT + total))