This repository was archived by the owner on Jun 13, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed
graphql_api/types/repository Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change 1515from graphql_api .actions .commits import repo_commits
1616from graphql_api .dataloader .commit import CommitLoader
1717from graphql_api .dataloader .owner import OwnerLoader
18- from graphql_api .helpers .connection import (
19- queryset_to_connection ,
20- )
18+ from graphql_api .helpers .connection import queryset_to_connection
2119from graphql_api .types .coverage_analytics .coverage_analytics import (
2220 CoverageAnalyticsProps ,
2321)
@@ -273,13 +271,12 @@ def resolve_repository_result_type(obj: Any, *_: Any) -> Optional[str]:
273271def resolve_is_first_pull_request (
274272 repository : Repository , info : GraphQLResolveInfo
275273) -> bool :
276- has_one_pr = repository .pull_requests .count () == 1
277-
278- if has_one_pr :
279- first_pr = repository .pull_requests .first ()
280- return not first_pr .compared_to
281-
282- return False
274+ # Get at most 2 PRs to determine if there's only one
275+ pull_requests = repository .pull_requests .values ("id" , "compared_to" )[:2 ]
276+ if len (pull_requests ) != 1 :
277+ return False
278+ # For single PR, check if it's a valid first PR by verifying no compared_to
279+ return pull_requests [0 ]["compared_to" ] is None
283280
284281
285282@repository_bindable .field ("isGithubRateLimited" )
You can’t perform that action at this time.
0 commit comments