Skip to content

Commit 4954fa5

Browse files
fix(workflows): add retry logic for closing sub-issues after merge
1 parent 8e45a25 commit 4954fa5

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

.github/workflows/bot-auto-merge.yml

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,22 @@ jobs:
172172
:rocket: *Auto-merged by pyplots CI*"
173173
fi
174174
175-
# Close sub-issue (ignore if already closed)
176-
gh issue close $SUB_ISSUE --reason completed 2>/dev/null || true
177-
echo "Sub-issue #$SUB_ISSUE closed"
175+
# Close sub-issue with retry logic
176+
for i in 1 2 3; do
177+
if gh issue close $SUB_ISSUE --reason completed; then
178+
echo "✓ Sub-issue #$SUB_ISSUE closed successfully"
179+
break
180+
else
181+
echo "Attempt $i: Failed to close #$SUB_ISSUE, retrying..."
182+
sleep 2
183+
fi
184+
done
185+
186+
# Verify closure
187+
STATE=$(gh issue view $SUB_ISSUE --json state -q '.state' 2>/dev/null || echo "UNKNOWN")
188+
if [ "$STATE" != "CLOSED" ]; then
189+
echo "::warning::Sub-issue #$SUB_ISSUE may not be closed (state: $STATE)"
190+
fi
178191
179192
- name: Get main issue number
180193
if: steps.check.outputs.should_run == 'true'
@@ -421,8 +434,16 @@ jobs:
421434
:rocket: *Auto-merged by pyplots CI*"
422435
fi
423436
424-
# Close sub-issue
425-
gh issue close $SUB_ISSUE --reason completed 2>/dev/null || true
437+
# Close sub-issue with retry logic
438+
for i in 1 2 3; do
439+
if gh issue close $SUB_ISSUE --reason completed; then
440+
echo "✓ Sub-issue #$SUB_ISSUE closed successfully"
441+
break
442+
else
443+
echo "Attempt $i: Failed to close #$SUB_ISSUE, retrying..."
444+
sleep 2
445+
fi
446+
done
426447
427448
- name: Check if all libraries are done
428449
if: steps.check.outputs.should_run == 'true'

0 commit comments

Comments
 (0)