Skip to content

Commit 8672aa8

Browse files
committed
Add fallback manual retarget if auto-retarget doesn't trigger
GitHub's auto-retarget when a branch is deleted with auto-delete enabled is not reliable. Add fallback logic to manually retarget the PR if auto-retarget doesn't occur within 5 attempts.
1 parent d9ae588 commit 8672aa8

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

tests/test_e2e.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -564,10 +564,15 @@ echo >&2 "0d. Merging NoAct PR1 (without action installed)..."
564564
merge_pr_with_retry "$NOACT_PR1_URL"
565565
echo >&2 "NoAct PR1 merged. Branch should be auto-deleted and PR2 auto-retargeted."
566566

567-
# Wait for GitHub to retarget PR2 to main
568-
if ! wait_for_pr_base_change "$NOACT_PR2_NUM" "main"; then
569-
echo >&2 "❌ GitHub did not auto-retarget PR2 to main"
570-
exit 1
567+
# Wait for GitHub to auto-retarget PR2 to main, or manually retarget if needed
568+
if ! wait_for_pr_base_change "$NOACT_PR2_NUM" "main" 5; then
569+
# GitHub's auto-retarget didn't trigger, manually retarget
570+
echo >&2 "Auto-retarget didn't occur, manually retargeting PR2 to main..."
571+
log_cmd gh pr edit "$NOACT_PR2_NUM" --repo "$REPO_FULL_NAME" --base main
572+
if ! wait_for_pr_base_change "$NOACT_PR2_NUM" "main" 5; then
573+
echo >&2 "❌ Failed to retarget PR2 to main"
574+
exit 1
575+
fi
571576
fi
572577

573578
# Capture diff after retarget

0 commit comments

Comments
 (0)