Skip to content

Commit

Permalink
Add SecretScanningAlertEvent webhook
Browse files Browse the repository at this point in the history
  • Loading branch information
IainSteers committed Feb 4, 2022
1 parent a842efc commit b87ea67
Show file tree
Hide file tree
Showing 5 changed files with 131 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 @@ -114,6 +114,8 @@ func (e *Event) ParsePayload() (payload interface{}, err error) {
payload = &RepositoryDispatchEvent{}
case "RepositoryVulnerabilityAlertEvent":
payload = &RepositoryVulnerabilityAlertEvent{}
case "SecretScanningAlertEvent":
payload = &SecretScanningAlertEvent{}
case "StarEvent":
payload = &StarEvent{}
case "StatusEvent":
Expand Down
20 changes: 20 additions & 0 deletions github/event_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,26 @@ type RepositoryVulnerabilityAlert struct {
DismissedAt *Timestamp `json:"dismissed_at,omitempty"`
}

// SecretScanningAlertEvent is triggered when a secret scanning alert occurs in a repository
// The Webhook name is secret_scanning_alert
//
// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#secret_scanning_alert
type SecretScanningAlertEvent struct {
// Action is the action that was performed. Possible values are: "created", "resolved", or "reopened".
Action *string `json:"action,omitempty"`

// Alert is the secret scanning alert involved in the event.
Alert *SecretScanningAlert `json:"alert,omitempty"`

// Only populated by the "resolved" and "reopen" actions
Sender *User `json:"sender,omitempty"`
// The following fields are only populated by Webhook events.
Repo *Repository `json:"repository,omitempty"`
Organization *Organization `json:"organization,omitempty"`
Enterprise *Enterprise `json:"enterprise,omitempty"`
Installation *Installation `json:"installation,omitempty"`
}

// StarEvent is triggered when a star is added or removed from a repository.
// The Webhook event name is "star".
//
Expand Down
56 changes: 56 additions & 0 deletions github/github-accessors.go

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

52 changes: 52 additions & 0 deletions github/github-accessors_test.go

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

1 change: 1 addition & 0 deletions github/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ var (
"repository_dispatch": "RepositoryDispatchEvent",
"repository_vulnerability_alert": "RepositoryVulnerabilityAlertEvent",
"release": "ReleaseEvent",
"secret_scanning_alert": "SecretScanningAlertEvent",
"star": "StarEvent",
"status": "StatusEvent",
"team": "TeamEvent",
Expand Down

0 comments on commit b87ea67

Please sign in to comment.