check_run and check_suite webhooks support

This commit is contained in:
Alex Mukho
2019-03-18 18:15:03 +02:00
parent a1051fd871
commit 4c7b9ae07d
5 changed files with 821 additions and 0 deletions
+10
View File
@@ -28,6 +28,8 @@ type Event string
// GitHub hook types
const (
CheckRunEvent Event = "check_run"
CheckSuiteEvent Event = "check_suite"
CommitCommentEvent Event = "commit_comment"
CreateEvent Event = "create"
DeleteEvent Event = "delete"
@@ -162,6 +164,14 @@ func (hook Webhook) Parse(r *http.Request, events ...Event) (interface{}, error)
}
switch gitHubEvent {
case CheckRunEvent:
var pl CheckRunPayload
err = json.Unmarshal([]byte(payload), &pl)
return pl, err
case CheckSuiteEvent:
var pl CheckSuitePayload
err = json.Unmarshal([]byte(payload), &pl)
return pl, err
case CommitCommentEvent:
var pl CommitCommentPayload
err = json.Unmarshal([]byte(payload), &pl)