Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for dependabot_alert webhook event #2888

Merged
merged 2 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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