@@ -10,7 +10,7 @@ import (
1010type PullRequestsPayload struct {
1111 ViewerCreated PullRequestAndTotalCount
1212 ReviewRequested PullRequestAndTotalCount
13- CurrentPRs [] PullRequest
13+ CurrentPR * PullRequest
1414}
1515
1616type PullRequestAndTotalCount struct {
@@ -262,13 +262,12 @@ func PullRequests(client *Client, repo ghrepo.Interface, currentPRNumber int, cu
262262 reviewRequested = append (reviewRequested , edge .Node )
263263 }
264264
265- var currentPRs []PullRequest
266- if resp .Repository .PullRequest != nil {
267- currentPRs = append (currentPRs , * resp .Repository .PullRequest )
268- } else {
265+ var currentPR = resp .Repository .PullRequest
266+ if currentPR == nil {
269267 for _ , edge := range resp .Repository .PullRequests .Edges {
270268 if edge .Node .HeadLabel () == currentPRHeadRef {
271- currentPRs = append (currentPRs , edge .Node )
269+ currentPR = & edge .Node
270+ break // Take the most recent PR for the current branch
272271 }
273272 }
274273 }
@@ -282,7 +281,7 @@ func PullRequests(client *Client, repo ghrepo.Interface, currentPRNumber int, cu
282281 PullRequests : reviewRequested ,
283282 TotalCount : resp .ReviewRequested .TotalCount ,
284283 },
285- CurrentPRs : currentPRs ,
284+ CurrentPR : currentPR ,
286285 }
287286
288287 return & payload , nil
0 commit comments