Skip to content

Commit

Permalink
fix npe in webhook that was accidental (#1845)
Browse files Browse the repository at this point in the history
  • Loading branch information
motatoes authored Nov 28, 2024
1 parent 662bddf commit 59caccc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions next/controllers/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,14 @@ func (d DiggerController) GithubAppWebHook(c *gin.Context) {
if *event.Action == "deleted" {
err := handleInstallationDeletedEvent(event)
if err != nil {
c.String(http.StatusInternalServerError, "Failed to handle webhook event.")
log.Printf("Failed to handle webhook event. %v", err)
return
}
}

c.String(http.StatusAccepted, "ok")
return

case *github.IssueCommentEvent:
log.Printf("IssueCommentEvent, action: %v\n", *event.Action)
case *github.PullRequestEvent:
Expand All @@ -81,7 +84,7 @@ func (d DiggerController) GithubAppWebHook(c *gin.Context) {
if err != nil {
log.Printf("handlePullRequestEvent error: %v", err)
}
c.String(http.StatusAccepted, err.Error())
c.String(http.StatusAccepted, "ok")
return

case *github.PushEvent:
Expand All @@ -90,7 +93,7 @@ func (d DiggerController) GithubAppWebHook(c *gin.Context) {
if err != nil {
log.Printf("handlePushEvent error: %v", err)
}
c.String(http.StatusAccepted, err.Error())
c.String(http.StatusAccepted, "ok")
return

default:
Expand Down

0 comments on commit 59caccc

Please sign in to comment.