Commit 5be4cfb23783

Vincent Demeester <vincent@sbr.pm>
2025-11-26 10:15:51
fix(tools): improve error handling in gh-restart-failed
- Detect and report workflows too old to restart (>1 month) - Distinguish between age errors and other failure types - Provide accurate status feedback instead of false success Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent ef5ed53
Changed files (1)
tools/gh-restart-failed.sh
@@ -219,8 +219,12 @@ while IFS= read -r pr_line; do
     echo "$failed_runs" | while IFS='|' read -r run_id workflow_name status; do
         echo -e "  ${GREEN}→${NC} Restarting: $workflow_name ($status)"
 
-        if gh run rerun "${REPO_FLAG[@]}" "$run_id" --failed 2>&1 | grep -v "^$"; then
-            echo -e "    ${GREEN}✓${NC} Restarted successfully"
+        rerun_output=$(gh run rerun "${REPO_FLAG[@]}" "$run_id" --failed 2>&1)
+
+        if echo "$rerun_output" | grep -q "created over a month ago"; then
+            echo -e "    ${YELLOW}⚠${NC} Cannot restart: workflow run is too old (>1 month)"
+        elif echo "$rerun_output" | grep -qi "error"; then
+            echo -e "    ${RED}✗${NC} Failed to restart: $rerun_output"
         else
             echo -e "    ${GREEN}✓${NC} Restarted successfully"
         fi