Skip to content

Commit

Permalink
Add support for dependabot_alert webhook event (google#2888)
Browse files Browse the repository at this point in the history
Fixes: google#2790.
  • Loading branch information
nikpivkin authored and gmlewis committed Sep 18, 2023
1 parent 94747d6 commit a7ba867
Show file tree
Hide file tree
Showing 8 changed files with 615 additions and 1 deletion.
4 changes: 3 additions & 1 deletion github/dependabot_alerts.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ type DependabotAlert struct {
DismissedReason *string `json:"dismissed_reason,omitempty"`
DismissedComment *string `json:"dismissed_comment,omitempty"`
FixedAt *Timestamp `json:"fixed_at,omitempty"`
Repository *Repository `json:"repository,omitempty"`
AutoDismissedAt *Timestamp `json:"auto_dismissed_at,omitempty"`
// The repository is always empty for events
Repository *Repository `json:"repository,omitempty"`
}

// ListAlertsOptions specifies the optional parameters to the DependabotService.ListRepoAlerts
Expand Down
19 changes: 19 additions & 0 deletions github/event_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,25 @@ type DeleteEvent struct {
Installation *Installation `json:"installation,omitempty"`
}

// DependabotAlertEvent is triggered when there is activity relating to Dependabot alerts.
// The Webhook event name is "dependabot_alert".
//
// GitHub API docs: https://docs.github.com/en/webhooks-and-events/webhooks/webhook-events-and-payloads#dependabot_alert
type DependabotAlertEvent struct {
Action *string `json:"action,omitempty"`
Alert *DependabotAlert `json:"alert,omitempty"`

// The following fields are only populated by Webhook events.
Installation *Installation `json:"installation,omitempty"`
Enterprise *Enterprise `json:"enterprise,omitempty"`
Repo *Repository `json:"repository,omitempty"`
Sender *User `json:"sender,omitempty"`

// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Organization *Organization `json:"organization,omitempty"`
}

// DeployKeyEvent is triggered when a deploy key is added or removed from a repository.
// The Webhook event name is "deploy_key".
//
Expand Down

0 comments on commit a7ba867

Please sign in to comment.