Skip to content

Commit

Permalink
Add support for parsing code_scanning_alerts in webhooks (#2392)
Browse files Browse the repository at this point in the history
Fixes: #2391.
  • Loading branch information
emilva committed Aug 13, 2022
1 parent 744a645 commit 388289c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions github/event.go
Expand Up @@ -36,6 +36,8 @@ func (e *Event) ParsePayload() (payload interface{}, err error) {
payload = &CheckRunEvent{}
case "CheckSuiteEvent":
payload = &CheckSuiteEvent{}
case "CodeScanningAlertEvent":
payload = &CodeScanningAlertEvent{}
case "CommitCommentEvent":
payload = &CommitCommentEvent{}
case "ContentReferenceEvent":
Expand Down
1 change: 1 addition & 0 deletions github/messages.go
Expand Up @@ -48,6 +48,7 @@ var (
"branch_protection_rule": "BranchProtectionRuleEvent",
"check_run": "CheckRunEvent",
"check_suite": "CheckSuiteEvent",
"code_scanning_alert": "CodeScanningAlertEvent",
"commit_comment": "CommitCommentEvent",
"content_reference": "ContentReferenceEvent",
"create": "CreateEvent",
Expand Down
4 changes: 4 additions & 0 deletions github/messages_test.go
Expand Up @@ -273,6 +273,10 @@ func TestParseWebHook(t *testing.T) {
payload: &CheckSuiteEvent{},
messageType: "check_suite",
},
{
payload: &CodeScanningAlertEvent{},
messageType: "code_scanning_alert",
},
{
payload: &CommitCommentEvent{},
messageType: "commit_comment",
Expand Down
1 change: 1 addition & 0 deletions github/repos_hooks_deliveries_test.go
Expand Up @@ -145,6 +145,7 @@ func TestRepositoriesService_RedeliverHookDelivery(t *testing.T) {
var hookDeliveryPayloadTypeToStruct = map[string]interface{}{
"check_run": &CheckRunEvent{},
"check_suite": &CheckSuiteEvent{},
"code_scanning_alert": &CodeScanningAlertEvent{},
"commit_comment": &CommitCommentEvent{},
"content_reference": &ContentReferenceEvent{},
"create": &CreateEvent{},
Expand Down

0 comments on commit 388289c

Please sign in to comment.