From 3cec58379ac829aff3a73b0e306b7611373ae9d3 Mon Sep 17 00:00:00 2001 From: Luke Hinds Date: Tue, 6 Jun 2023 15:34:26 +0100 Subject: [PATCH] Add GitHub App event security_advisory The GitHub App can transmit dependabot events for security_advisory This PR adds the event, it is based off #2392, so hopefully the mapping is still the same. Resolves: #2798 Signed-off-by: Luke Hinds --- github/event.go | 2 ++ github/messages.go | 1 + github/messages_test.go | 4 ++++ github/repos_hooks_deliveries_test.go | 1 + 4 files changed, 8 insertions(+) diff --git a/github/event.go b/github/event.go index 20907a99321..4ee25603a83 100644 --- a/github/event.go +++ b/github/event.go @@ -127,6 +127,8 @@ func (e *Event) ParsePayload() (payload interface{}, err error) { payload = &RepositoryVulnerabilityAlertEvent{} case "SecretScanningAlertEvent": payload = &SecretScanningAlertEvent{} + case "SecurityAdvisoryEvent": + payload = &SecurityAdvisoryEvent{} case "StarEvent": payload = &StarEvent{} case "StatusEvent": diff --git a/github/messages.go b/github/messages.go index 8547b8810f8..bb5ae3f3895 100644 --- a/github/messages.go +++ b/github/messages.go @@ -93,6 +93,7 @@ var ( "repository_vulnerability_alert": "RepositoryVulnerabilityAlertEvent", "release": "ReleaseEvent", "secret_scanning_alert": "SecretScanningAlertEvent", + "security_advisory": "SecurityAdvisoryEvent", "star": "StarEvent", "status": "StatusEvent", "team": "TeamEvent", diff --git a/github/messages_test.go b/github/messages_test.go index 8dbb0fdf996..80fb3e5ff54 100644 --- a/github/messages_test.go +++ b/github/messages_test.go @@ -440,6 +440,10 @@ func TestParseWebHook(t *testing.T) { payload: &SecretScanningAlertEvent{}, messageType: "secret_scanning_alert", }, + { + payload: &SecurityAdvisoryEvent{}, + messageType: "security_advisory", + }, { payload: &StarEvent{}, messageType: "star", diff --git a/github/repos_hooks_deliveries_test.go b/github/repos_hooks_deliveries_test.go index ef453996a90..d1dda365194 100644 --- a/github/repos_hooks_deliveries_test.go +++ b/github/repos_hooks_deliveries_test.go @@ -189,6 +189,7 @@ var hookDeliveryPayloadTypeToStruct = map[string]interface{}{ "repository_import": &RepositoryImportEvent{}, "repository_vulnerability_alert": &RepositoryVulnerabilityAlertEvent{}, "secret_scanning_alert": &SecretScanningAlertEvent{}, + "security_advisory": &SecurityAdvisoryEvent{}, "star": &StarEvent{}, "status": &StatusEvent{}, "team": &TeamEvent{},