-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add RequiredApprovingReviewCount to PullRequestReviewsEnforcement #880
Changes from 12 commits
a49ec22
c51d8bb
d578d31
70d6dcf
df5d65e
ef58a35
5af409a
4e70bd3
da53bef
2b2e379
1cba8d0
485a5d5
09a561d
0966f88
7aff404
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -565,6 +565,9 @@ type PullRequestReviewsEnforcement struct { | |
DismissStaleReviews bool `json:"dismiss_stale_reviews"` | ||
// RequireCodeOwnerReviews specifies if an approved review is required in pull requests including files with a designated code owner. | ||
RequireCodeOwnerReviews bool `json:"require_code_owner_reviews"` | ||
// RequiredApprovingReviewCount specifies the number of approvals required before the pull request can be merged. | ||
// Valid values are 1-6. | ||
RequiredApprovingReviewCount int `json:"required_approving_review_count"` | ||
} | ||
|
||
// PullRequestReviewsEnforcementRequest represents request to set the pull request review | ||
|
@@ -579,6 +582,9 @@ type PullRequestReviewsEnforcementRequest struct { | |
DismissStaleReviews bool `json:"dismiss_stale_reviews"` | ||
// RequireCodeOwnerReviews specifies if an approved review is required in pull requests including files with a designated code owner. | ||
RequireCodeOwnerReviews bool `json:"require_code_owner_reviews"` | ||
// RequiredApprovingReviewCount specifies the number of approvals required before the pull request can be merged. | ||
// Valid values are 1-6. | ||
RequiredApprovingReviewCount int `json:"required_approving_review_count,omitempty"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it can be omitted, then I think we need to make this type There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Issue with the comment, I forgot to update it. Its a required field. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Then in that case, should we get rid of the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What are your thoughts, @victoryNap on this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good call. |
||
} | ||
|
||
// PullRequestReviewsEnforcementUpdate represents request to patch the pull request review | ||
|
@@ -591,6 +597,9 @@ type PullRequestReviewsEnforcementUpdate struct { | |
DismissStaleReviews *bool `json:"dismiss_stale_reviews,omitempty"` | ||
// RequireCodeOwnerReviews specifies if an approved review is required in pull requests including files with a designated code owner. | ||
RequireCodeOwnerReviews bool `json:"require_code_owner_reviews,omitempty"` | ||
// RequiredApprovingReviewCount specifies the number of approvals required before the pull request can be merged. | ||
// Valid values are 1 - 6. | ||
RequiredApprovingReviewCount int `json:"required_approving_review_count,omitempty"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ...and this one too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also Updated |
||
} | ||
|
||
// AdminEnforcement represents the configuration to enforce required status checks for repository administrators. | ||
|
@@ -655,7 +664,7 @@ func (s *RepositoriesService) ListBranches(ctx context.Context, owner string, re | |
} | ||
|
||
// TODO: remove custom Accept header when this API fully launches | ||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview) | ||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) | ||
|
||
var branches []*Branch | ||
resp, err := s.client.Do(ctx, req, &branches) | ||
|
@@ -677,7 +686,7 @@ func (s *RepositoriesService) GetBranch(ctx context.Context, owner, repo, branch | |
} | ||
|
||
// TODO: remove custom Accept header when this API fully launches | ||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview) | ||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) | ||
|
||
b := new(Branch) | ||
resp, err := s.client.Do(ctx, req, b) | ||
|
@@ -699,7 +708,7 @@ func (s *RepositoriesService) GetBranchProtection(ctx context.Context, owner, re | |
} | ||
|
||
// TODO: remove custom Accept header when this API fully launches | ||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview) | ||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) | ||
|
||
p := new(Protection) | ||
resp, err := s.client.Do(ctx, req, p) | ||
|
@@ -721,7 +730,7 @@ func (s *RepositoriesService) GetRequiredStatusChecks(ctx context.Context, owner | |
} | ||
|
||
// TODO: remove custom Accept header when this API fully launches | ||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview) | ||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) | ||
|
||
p := new(RequiredStatusChecks) | ||
resp, err := s.client.Do(ctx, req, p) | ||
|
@@ -743,7 +752,7 @@ func (s *RepositoriesService) ListRequiredStatusChecksContexts(ctx context.Conte | |
} | ||
|
||
// TODO: remove custom Accept header when this API fully launches | ||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview) | ||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) | ||
|
||
resp, err = s.client.Do(ctx, req, &contexts) | ||
if err != nil { | ||
|
@@ -764,7 +773,7 @@ func (s *RepositoriesService) UpdateBranchProtection(ctx context.Context, owner, | |
} | ||
|
||
// TODO: remove custom Accept header when this API fully launches | ||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview) | ||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) | ||
|
||
p := new(Protection) | ||
resp, err := s.client.Do(ctx, req, p) | ||
|
@@ -786,7 +795,7 @@ func (s *RepositoriesService) RemoveBranchProtection(ctx context.Context, owner, | |
} | ||
|
||
// TODO: remove custom Accept header when this API fully launches | ||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview) | ||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) | ||
|
||
return s.client.Do(ctx, req, nil) | ||
} | ||
|
@@ -821,7 +830,7 @@ func (s *RepositoriesService) GetPullRequestReviewEnforcement(ctx context.Contex | |
} | ||
|
||
// TODO: remove custom Accept header when this API fully launches | ||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview) | ||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) | ||
|
||
r := new(PullRequestReviewsEnforcement) | ||
resp, err := s.client.Do(ctx, req, r) | ||
|
@@ -844,7 +853,7 @@ func (s *RepositoriesService) UpdatePullRequestReviewEnforcement(ctx context.Con | |
} | ||
|
||
// TODO: remove custom Accept header when this API fully launches | ||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview) | ||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) | ||
|
||
r := new(PullRequestReviewsEnforcement) | ||
resp, err := s.client.Do(ctx, req, r) | ||
|
@@ -872,7 +881,7 @@ func (s *RepositoriesService) DisableDismissalRestrictions(ctx context.Context, | |
} | ||
|
||
// TODO: remove custom Accept header when this API fully launches | ||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview) | ||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) | ||
|
||
r := new(PullRequestReviewsEnforcement) | ||
resp, err := s.client.Do(ctx, req, r) | ||
|
@@ -894,7 +903,7 @@ func (s *RepositoriesService) RemovePullRequestReviewEnforcement(ctx context.Con | |
} | ||
|
||
// TODO: remove custom Accept header when this API fully launches | ||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview) | ||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) | ||
|
||
return s.client.Do(ctx, req, nil) | ||
} | ||
|
@@ -910,7 +919,7 @@ func (s *RepositoriesService) GetAdminEnforcement(ctx context.Context, owner, re | |
} | ||
|
||
// TODO: remove custom Accept header when this API fully launches | ||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview) | ||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) | ||
|
||
r := new(AdminEnforcement) | ||
resp, err := s.client.Do(ctx, req, r) | ||
|
@@ -933,7 +942,7 @@ func (s *RepositoriesService) AddAdminEnforcement(ctx context.Context, owner, re | |
} | ||
|
||
// TODO: remove custom Accept header when this API fully launches | ||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview) | ||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) | ||
|
||
r := new(AdminEnforcement) | ||
resp, err := s.client.Do(ctx, req, r) | ||
|
@@ -955,7 +964,7 @@ func (s *RepositoriesService) RemoveAdminEnforcement(ctx context.Context, owner, | |
} | ||
|
||
// TODO: remove custom Accept header when this API fully launches | ||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview) | ||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) | ||
|
||
return s.client.Do(ctx, req, nil) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems odd that there wasn't a GitHub Developer API announcement revoking this custom media type. (Unless maybe I missed it?)
The last one I see was: https://developer.github.com/changes/2016-06-27-protected-branches-api-update/
and the new docs only mention the new custom media type, so maybe this one silently went away?
I'm guessing that's how you interpret the current situation, @victoryNap, judging from the PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also didn't see an update saying it was no longer a preview, but thats the assumption that I made, their documentation makes no reference to the previous preview header, only to the new one that I've added.