fix: increase max branches limit to 5000 to fix #10332 (#10333)

This commit is contained in:
Xingyao Wang 2025-08-14 16:44:12 -04:00 committed by GitHub
parent 228e50df9c
commit e40681ca61
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -496,15 +496,15 @@ class GitHubService(BaseGitService, GitService, InstallationsService):
"""Get branches for a repository"""
url = f'{self.BASE_URL}/repos/{repository}/branches'
# Set maximum branches to fetch (10 pages with 100 per page)
MAX_BRANCHES = 1000
# Set maximum branches to fetch (100 per page)
MAX_BRANCHES = 5_000
PER_PAGE = 100
all_branches: list[Branch] = []
page = 1
# Fetch up to 10 pages of branches
while page <= 10 and len(all_branches) < MAX_BRANCHES:
while len(all_branches) < MAX_BRANCHES:
params = {'per_page': str(PER_PAGE), 'page': str(page)}
response, headers = await self._make_request(url, params)