Skip to content

Commit 21df6e0

Browse files
authored
Support deployment protection rule event type (#2773)
Fixes: #2774.
1 parent 53cecba commit 21df6e0

File tree

7 files changed

+558
-0
lines changed

7 files changed

+558
-0
lines changed

github/event.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ func (e *Event) ParsePayload() (payload interface{}, err error) {
4949
payload = &DeployKeyEvent{}
5050
case "DeploymentEvent":
5151
payload = &DeploymentEvent{}
52+
case "DeploymentProtectionRuleEvent":
53+
payload = &DeploymentProtectionRuleEvent{}
5254
case "DeploymentStatusEvent":
5355
payload = &DeploymentStatusEvent{}
5456
case "DiscussionEvent":

github/event_types.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,25 @@ type DeploymentEvent struct {
173173
Installation *Installation `json:"installation,omitempty"`
174174
}
175175

176+
// DeploymentProtectionRuleEvent represents a deployment protection rule event.
177+
// The Webhook event name is "deployment_protection_rule".
178+
//
179+
// GitHub API docs: https://docs.github.com/webhooks-and-events/webhooks/webhook-events-and-payloads#deployment_protection_rule
180+
type DeploymentProtectionRuleEvent struct {
181+
Action *string `json:"action,omitempty"`
182+
Environment *string `json:"environment,omitempty"`
183+
Event *string `json:"event,omitempty"`
184+
185+
// The URL Github provides for a third-party to use in order to pass/fail a deployment gate
186+
DeploymentCallbackURL *string `json:"deployment_callback_url,omitempty"`
187+
Deployment *Deployment `json:"deployment,omitempty"`
188+
Repo *Repository `json:"repository,omitempty"`
189+
Organization *Organization `json:"organization,omitempty"`
190+
PullRequests []*PullRequest `json:"pull_requests,omitempty"`
191+
Sender *User `json:"sender,omitempty"`
192+
Installation *Installation `json:"installation,omitempty"`
193+
}
194+
176195
// DeploymentStatusEvent represents a deployment status.
177196
// The Webhook event name is "deployment_status".
178197
//

0 commit comments

Comments
 (0)