Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions deployment/cleanup_workflows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down