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 parsing code_scanning_alerts in webhooks #2392

Merged
merged 1 commit into from Aug 13, 2022
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
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