You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix critical GitHub API pagination bugs in auto-merge workflow (#5580)
## Summary
Fixes a critical bug where the auto-merge workflow only fetched the
first 30 results from GitHub API list operations, causing it to miss
failed checks and incorrectly merge PRs.
## Root Cause
PR #5578 had 2 failed GB200 tests that occurred early in the CI run. By
the time the auto-merge action ran 4+ hours later, 27 newer successful
statuses had been created. Since the workflow used unpaginated API calls
(default limit: 30 items), the failed statuses were pushed beyond the
first page and never detected.
## Changes
Fixed 4 GitHub API calls to use `github.paginate()`:
1. `listCommitStatusesForRef` - Was only checking 30 of 57+ statuses
2. `checks.listForRef` - Could miss failed checks if >30 exist
3. `issues.listComments` - Could miss status comment if >30 comments
4. `pulls.list` - Could miss PR if >30 open PRs on branch
Also simplified the `pr_approved` check logic which was deriving
approval status from `mergeable_state` in a confusing way. The workflow
now shows the actual `mergeable_state` value in status comments for
transparency.
## Impact
The auto-merge workflow will now correctly detect ALL failures
regardless of how many statuses exist, preventing incorrect merges like
#5578.
---------
Co-authored-by: Claude <[email protected]>
0 commit comments