Skip to content

Commit 55021d5

Browse files
Add BranchProtectionRuleEvent (#2102)
Fixes: #2098.
1 parent dfcb780 commit 55021d5

File tree

7 files changed

+601
-0
lines changed

7 files changed

+601
-0
lines changed

github/event.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ func (e Event) String() string {
3030
// a value of the corresponding struct type will be returned.
3131
func (e *Event) ParsePayload() (payload interface{}, err error) {
3232
switch *e.Type {
33+
case "BranchProtectionRuleEvent":
34+
payload = &BranchProtectionRuleEvent{}
3335
case "CheckRunEvent":
3436
payload = &CheckRunEvent{}
3537
case "CheckSuiteEvent":

github/event_types.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,19 @@ type RequestedAction struct {
1515
Identifier string `json:"identifier"` // The integrator reference of the action requested by the user.
1616
}
1717

18+
// BranchProtectionRuleEvent triggered when a check suite is "created", "edited", or "deleted".
19+
// The Webhook event name is "branch_protection_rule".
20+
//
21+
// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#branch_protection_rule
22+
type BranchProtectionRuleEvent struct {
23+
Action *string `json:"action,omitempty"`
24+
Rule *BranchProtectionRule `json:"rule,omitempty"`
25+
Changes *ProtectionChanges `json:"changes,omitempty"`
26+
Repo *Repository `json:"repository,omitempty"`
27+
Org *Organization `json:"organization,omitempty"`
28+
Sender *User `json:"sender,omitempty"`
29+
}
30+
1831
// CheckRunEvent is triggered when a check run is "created", "completed", or "rerequested".
1932
// The Webhook event name is "check_run".
2033
//

github/github-accessors.go

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

0 commit comments

Comments
 (0)