Skip to content

Commit

Permalink
Allow receiving ping event from GitHub
Browse files Browse the repository at this point in the history
  • Loading branch information
motoki317 committed Apr 20, 2024
1 parent 0c9afc8 commit 20ae031
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/infrastructure/webhook/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ import (
var githubHook = lo.Must(github.New())

func (r *Receiver) githubHandler(c echo.Context) error {
rawPayload, err := githubHook.Parse(c.Request(), github.PushEvent)
rawPayload, err := githubHook.Parse(c.Request(), github.PingEvent, github.PushEvent)
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, err.Error())
}

// https://docs.github.com/en/rest/repos/repos
switch p := rawPayload.(type) {
case github.PingPayload:
// no-op
case github.PushPayload:
urls := []string{
p.Repository.HTMLURL, // https://github.com/octocat/Hello-World
Expand Down

0 comments on commit 20ae031

Please sign in to comment.