Skip to content

Commit e1c28bc

Browse files
authored
Add checks field to RequiredStatusChecks (#2276)
Fixes: #2274.
1 parent 51df45c commit e1c28bc

File tree

4 files changed

+318
-11
lines changed

4 files changed

+318
-11
lines changed

github/github-accessors.go

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/github-accessors_test.go

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/repos.go

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -877,14 +877,33 @@ type RequiredStatusChecks struct {
877877
// Require branches to be up to date before merging. (Required.)
878878
Strict bool `json:"strict"`
879879
// The list of status checks to require in order to merge into this
880-
// branch. (Required; use []string{} instead of nil for empty list.)
881-
Contexts []string `json:"contexts"`
880+
// branch. (Deprecated. Note: only one of Contexts/Checks can be populated,
881+
// but at least one must be populated).
882+
Contexts []string `json:"contexts,omitempty"`
883+
// The list of status checks to require in order to merge into this
884+
// branch.
885+
Checks []*RequiredStatusCheck `json:"checks,omitempty"`
882886
}
883887

884888
// RequiredStatusChecksRequest represents a request to edit a protected branch's status checks.
885889
type RequiredStatusChecksRequest struct {
886-
Strict *bool `json:"strict,omitempty"`
887-
Contexts []string `json:"contexts,omitempty"`
890+
Strict *bool `json:"strict,omitempty"`
891+
// Note: if both Contexts and Checks are populated,
892+
// the GitHub API will only use Checks.
893+
Contexts []string `json:"contexts,omitempty"`
894+
Checks []*RequiredStatusCheck `json:"checks,omitempty"`
895+
}
896+
897+
// RequiredStatusCheck represents a status check of a protected branch.
898+
type RequiredStatusCheck struct {
899+
// The name of the required check.
900+
Context string `json:"context"`
901+
// The ID of the GitHub App that must provide this check.
902+
// Omit this field to automatically select the GitHub App
903+
// that has recently provided this check,
904+
// or any app if it was not set by a GitHub App.
905+
// Pass -1 to explicitly allow any app to set the status.
906+
AppID *int64 `json:"app_id,omitempty"`
888907
}
889908

890909
// PullRequestReviewsEnforcement represents the pull request reviews enforcement of a protected branch.

0 commit comments

Comments
 (0)