Skip to content

Commit

Permalink
Add BranchProtectionRuleEvent (#2102)
Browse files Browse the repository at this point in the history
Fixes: #2098.
  • Loading branch information
bhogatemadhura committed Sep 23, 2021
1 parent dfcb780 commit 55021d5
Show file tree
Hide file tree
Showing 7 changed files with 601 additions and 0 deletions.
2 changes: 2 additions & 0 deletions github/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ func (e Event) String() string {
// a value of the corresponding struct type will be returned.
func (e *Event) ParsePayload() (payload interface{}, err error) {
switch *e.Type {
case "BranchProtectionRuleEvent":
payload = &BranchProtectionRuleEvent{}
case "CheckRunEvent":
payload = &CheckRunEvent{}
case "CheckSuiteEvent":
Expand Down
13 changes: 13 additions & 0 deletions github/event_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@ type RequestedAction struct {
Identifier string `json:"identifier"` // The integrator reference of the action requested by the user.
}

// BranchProtectionRuleEvent triggered when a check suite is "created", "edited", or "deleted".
// The Webhook event name is "branch_protection_rule".
//
// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#branch_protection_rule
type BranchProtectionRuleEvent struct {
Action *string `json:"action,omitempty"`
Rule *BranchProtectionRule `json:"rule,omitempty"`
Changes *ProtectionChanges `json:"changes,omitempty"`
Repo *Repository `json:"repository,omitempty"`
Org *Organization `json:"organization,omitempty"`
Sender *User `json:"sender,omitempty"`
}

// CheckRunEvent is triggered when a check run is "created", "completed", or "rerequested".
// The Webhook event name is "check_run".
//
Expand Down
248 changes: 248 additions & 0 deletions github/github-accessors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 55021d5

Please sign in to comment.