@@ -16,10 +16,11 @@ import (
1616)
1717
1818type PullRequestsPayload struct {
19- ViewerCreated PullRequestAndTotalCount
20- ReviewRequested PullRequestAndTotalCount
21- CurrentPR * PullRequest
22- DefaultBranch string
19+ ViewerCreated PullRequestAndTotalCount
20+ ReviewRequested PullRequestAndTotalCount
21+ CurrentPR * PullRequest
22+ DefaultBranch string
23+ StrictProtection bool
2324}
2425
2526type PullRequestAndTotalCount struct {
@@ -28,16 +29,17 @@ type PullRequestAndTotalCount struct {
2829}
2930
3031type PullRequest struct {
31- ID string
32- Number int
33- Title string
34- State string
35- Closed bool
36- URL string
37- BaseRefName string
38- HeadRefName string
39- Body string
40- Mergeable string
32+ ID string
33+ Number int
34+ Title string
35+ State string
36+ Closed bool
37+ URL string
38+ BaseRefName string
39+ HeadRefName string
40+ Body string
41+ Mergeable string
42+ MergeStateStatus string
4143
4244 Author struct {
4345 Login string
@@ -289,7 +291,10 @@ func PullRequests(client *Client, repo ghrepo.Interface, currentPRNumber int, cu
289291 type response struct {
290292 Repository struct {
291293 DefaultBranchRef struct {
292- Name string
294+ Name string
295+ BranchProtectionRule struct {
296+ RequiresStrictStatusChecks bool
297+ }
293298 }
294299 PullRequests edges
295300 PullRequest * PullRequest
@@ -341,6 +346,7 @@ func PullRequests(client *Client, repo ghrepo.Interface, currentPRNumber int, cu
341346 state
342347 url
343348 headRefName
349+ mergeStateStatus
344350 headRepositoryOwner {
345351 login
346352 }
@@ -357,7 +363,12 @@ func PullRequests(client *Client, repo ghrepo.Interface, currentPRNumber int, cu
357363 queryPrefix := `
358364 query PullRequestStatus($owner: String!, $repo: String!, $headRefName: String!, $viewerQuery: String!, $reviewerQuery: String!, $per_page: Int = 10) {
359365 repository(owner: $owner, name: $repo) {
360- defaultBranchRef { name }
366+ defaultBranchRef {
367+ name
368+ branchProtectionRule {
369+ requiresStrictStatusChecks
370+ }
371+ }
361372 pullRequests(headRefName: $headRefName, first: $per_page, orderBy: { field: CREATED_AT, direction: DESC }) {
362373 totalCount
363374 edges {
@@ -372,7 +383,12 @@ func PullRequests(client *Client, repo ghrepo.Interface, currentPRNumber int, cu
372383 queryPrefix = `
373384 query PullRequestStatus($owner: String!, $repo: String!, $number: Int!, $viewerQuery: String!, $reviewerQuery: String!, $per_page: Int = 10) {
374385 repository(owner: $owner, name: $repo) {
375- defaultBranchRef { name }
386+ defaultBranchRef {
387+ name
388+ branchProtectionRule {
389+ requiresStrictStatusChecks
390+ }
391+ }
376392 pullRequest(number: $number) {
377393 ...prWithReviews
378394 }
@@ -459,8 +475,9 @@ func PullRequests(client *Client, repo ghrepo.Interface, currentPRNumber int, cu
459475 PullRequests : reviewRequested ,
460476 TotalCount : resp .ReviewRequested .TotalCount ,
461477 },
462- CurrentPR : currentPR ,
463- DefaultBranch : resp .Repository .DefaultBranchRef .Name ,
478+ CurrentPR : currentPR ,
479+ DefaultBranch : resp .Repository .DefaultBranchRef .Name ,
480+ StrictProtection : resp .Repository .DefaultBranchRef .BranchProtectionRule .RequiresStrictStatusChecks ,
464481 }
465482
466483 return & payload , nil
0 commit comments