@@ -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
@@ -281,7 +283,10 @@ func PullRequests(client *Client, repo ghrepo.Interface, currentPRNumber int, cu
281283 type response struct {
282284 Repository struct {
283285 DefaultBranchRef struct {
284- Name string
286+ Name string
287+ BranchProtectionRule struct {
288+ RequiresStrictStatusChecks bool
289+ }
285290 }
286291 PullRequests edges
287292 PullRequest * PullRequest
@@ -333,6 +338,7 @@ func PullRequests(client *Client, repo ghrepo.Interface, currentPRNumber int, cu
333338 state
334339 url
335340 headRefName
341+ mergeStateStatus
336342 headRepositoryOwner {
337343 login
338344 }
@@ -349,7 +355,12 @@ func PullRequests(client *Client, repo ghrepo.Interface, currentPRNumber int, cu
349355 queryPrefix := `
350356 query PullRequestStatus($owner: String!, $repo: String!, $headRefName: String!, $viewerQuery: String!, $reviewerQuery: String!, $per_page: Int = 10) {
351357 repository(owner: $owner, name: $repo) {
352- defaultBranchRef { name }
358+ defaultBranchRef {
359+ name
360+ branchProtectionRule {
361+ requiresStrictStatusChecks
362+ }
363+ }
353364 pullRequests(headRefName: $headRefName, first: $per_page, orderBy: { field: CREATED_AT, direction: DESC }) {
354365 totalCount
355366 edges {
@@ -364,7 +375,12 @@ func PullRequests(client *Client, repo ghrepo.Interface, currentPRNumber int, cu
364375 queryPrefix = `
365376 query PullRequestStatus($owner: String!, $repo: String!, $number: Int!, $viewerQuery: String!, $reviewerQuery: String!, $per_page: Int = 10) {
366377 repository(owner: $owner, name: $repo) {
367- defaultBranchRef { name }
378+ defaultBranchRef {
379+ name
380+ branchProtectionRule {
381+ requiresStrictStatusChecks
382+ }
383+ }
368384 pullRequest(number: $number) {
369385 ...prWithReviews
370386 }
@@ -451,8 +467,9 @@ func PullRequests(client *Client, repo ghrepo.Interface, currentPRNumber int, cu
451467 PullRequests : reviewRequested ,
452468 TotalCount : resp .ReviewRequested .TotalCount ,
453469 },
454- CurrentPR : currentPR ,
455- DefaultBranch : resp .Repository .DefaultBranchRef .Name ,
470+ CurrentPR : currentPR ,
471+ DefaultBranch : resp .Repository .DefaultBranchRef .Name ,
472+ StrictProtection : resp .Repository .DefaultBranchRef .BranchProtectionRule .RequiresStrictStatusChecks ,
456473 }
457474
458475 return & payload , nil
0 commit comments