@@ -28,6 +28,7 @@ type PullRequestsPayload struct {
2828 ViewerCreated PullRequestAndTotalCount
2929 ReviewRequested PullRequestAndTotalCount
3030 CurrentPR * PullRequest
31+ DefaultBranch string
3132}
3233
3334type PullRequestAndTotalCount struct {
@@ -204,6 +205,9 @@ func PullRequests(client *Client, repo ghrepo.Interface, currentPRNumber int, cu
204205
205206 type response struct {
206207 Repository struct {
208+ DefaultBranchRef struct {
209+ Name string
210+ }
207211 PullRequests edges
208212 PullRequest * PullRequest
209213 }
@@ -252,6 +256,7 @@ func PullRequests(client *Client, repo ghrepo.Interface, currentPRNumber int, cu
252256 queryPrefix := `
253257 query($owner: String!, $repo: String!, $headRefName: String!, $viewerQuery: String!, $reviewerQuery: String!, $per_page: Int = 10) {
254258 repository(owner: $owner, name: $repo) {
259+ defaultBranchRef { name }
255260 pullRequests(headRefName: $headRefName, first: $per_page, orderBy: { field: CREATED_AT, direction: DESC }) {
256261 totalCount
257262 edges {
@@ -266,6 +271,7 @@ func PullRequests(client *Client, repo ghrepo.Interface, currentPRNumber int, cu
266271 queryPrefix = `
267272 query($owner: String!, $repo: String!, $number: Int!, $viewerQuery: String!, $reviewerQuery: String!, $per_page: Int = 10) {
268273 repository(owner: $owner, name: $repo) {
274+ defaultBranchRef { name }
269275 pullRequest(number: $number) {
270276 ...prWithReviews
271277 }
@@ -345,7 +351,8 @@ func PullRequests(client *Client, repo ghrepo.Interface, currentPRNumber int, cu
345351 PullRequests : reviewRequested ,
346352 TotalCount : resp .ReviewRequested .TotalCount ,
347353 },
348- CurrentPR : currentPR ,
354+ CurrentPR : currentPR ,
355+ DefaultBranch : resp .Repository .DefaultBranchRef .Name ,
349356 }
350357
351358 return & payload , nil
0 commit comments