This repository was archived by the owner on Jun 13, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -513,11 +513,6 @@ def test_repository_is_first_pull_request(self) -> None:
513513
514514 assert data ["me" ]["owner" ]["repository" ]["isFirstPullRequest" ] == True
515515
516- assert (
517- repo .pull_requests .values ("id" )[:2 ].query
518- == 'SELECT "pull_requests"."id" FROM "pull_requests" WHERE "pull_requests"."repoid" = 1 ORDER BY "pull_requests"."pullid" DESC LIMIT 2'
519- )
520-
521516 def test_repository_is_first_pull_request_compared_to_not_none (self ) -> None :
522517 repo = RepositoryFactory (
523518 author = self .owner ,
Original file line number Diff line number Diff line change @@ -266,12 +266,15 @@ def resolve_is_first_pull_request(
266266 repository : Repository , info : GraphQLResolveInfo
267267) -> bool :
268268 try :
269- # SELECT "pull_requests"."id" FROM "pull_requests" WHERE "pull_requests"."repoid" = 1 ORDER BY "pull_requests"."pullid" DESC LIMIT 2
270- pull_requests = repository .pull_requests .values ("id" )[:2 ]
271- return len (pull_requests ) == 1
269+ # Get at most 2 PRs to determine if there's only one
270+ pull_requests = repository .pull_requests .values ("id" , "compared_to" )[:2 ]
271+ if len (pull_requests ) != 1 :
272+ return False
273+ # For single PR, check if it's a valid first PR by verifying no compared_to
274+ return pull_requests [0 ]["compared_to" ] is None
272275 except Exception as e :
273276 log .error (
274- "Error checking is_first_pull_request" ,
277+ "Error checking is_first_pull_request, assuming False " ,
275278 extra = dict (repo_id = repository .repoid , error = str (e )),
276279 )
277280 return False
You can’t perform that action at this time.
0 commit comments