Skip to content

Conversation

@villelaitila
Copy link
Contributor

Summary

  • Capture PR number when creating the PR via gh pr create
  • Use PR number as fallback when branch-based lookup fails (happens when GitHub auto-deletes branch after merge)
  • Add _extract_pr_number helper to parse PR URL from gh output

Problem

When using --yes flag, the automated polling mechanism used gh pr view <branch-name> to check PR status. However, when a PR is merged, GitHub automatically deletes the source branch, causing the command to fail with "no pull requests found".

Solution

Now the script:

  1. Captures the PR number from the gh pr create output URL
  2. First tries polling by branch name (works while PR is open)
  3. Falls back to polling by PR number if branch lookup fails (works after merge)

Test plan

  • Added comprehensive test coverage for polling mechanism (8 tests)
  • Tests cover: merged detection, closed detection, branch deletion fallback, timeout, waiting for open PR
  • All tests pass: pytest tests/test_release_automation.py -v

🤖 Generated with Claude Code

When a PR is merged, GitHub deletes the branch automatically. This caused
'gh pr view <branch-name>' to fail with "no pull requests found", breaking
the --yes flag's automated polling feature.

Changes:
- Capture PR number when creating the PR via 'gh pr create'
- Use PR number as fallback when branch-based lookup fails
- Add _extract_pr_number helper to parse PR URL from gh output
- Update wait_for_pr_merge to accept branch_name and pr_number params

The fix ensures polling continues to work even after the PR branch is
deleted, by falling back to 'gh pr view <number>' which always works.

Includes comprehensive test coverage for the polling mechanism.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@villelaitila villelaitila force-pushed the fix-pr-polling-branch-deleted branch from b5b040a to 82adcca Compare December 16, 2025 20:40
@softagram-bot
Copy link

Looking good 🎉

See the full Softagram report

@villelaitila villelaitila merged commit c872f60 into softagram:main Dec 16, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants