diff --git a/webhook/function.go b/webhook/function.go index 8e6f426..e04307d 100644 --- a/webhook/function.go +++ b/webhook/function.go @@ -38,7 +38,7 @@ func Handle(w http.ResponseWriter, r *http.Request) { } hook, _ := github.New(github.Options.Secret(githubSecret)) - payload, err := hook.Parse(r, github.PullRequestEvent) + payload, err := hook.Parse(r, github.PullRequestEvent, github.PingEvent) if err == github.ErrMissingHubSignatureHeader { http.Error(w, fmt.Sprintf("%s: %s", http.StatusText(http.StatusUnauthorized), err), http.StatusUnauthorized) @@ -52,6 +52,12 @@ func Handle(w http.ResponseWriter, r *http.Request) { return } + if _, ok := payload.(github.PingPayload); ok { + http.Error(w, "Pong", http.StatusOK) + + return + } + pullRequest, ok := payload.(github.PullRequestPayload) if !ok {