Skip to content

Commit

Permalink
Fix type casting for webhooks (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
ungureanuvladvictor authored Sep 26, 2017
1 parent e6a0d21 commit 2ae38d4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions github/hook_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,19 @@ func ProcessHook(c echo.Context, hookSecret string) (*ProcessResult, error) {
logger.Debugf("Got a %s event", webHookType)
switch webHookType {
case StatusEvent:
event := webHook.(github.StatusEvent)
event := webHook.(*github.StatusEvent)
return &ProcessResult{RepoID: event.Repo.GetID(), SHA: event.GetSHA(), Merge: true}, nil
case PullRequestEvent:
event := webHook.(github.PullRequestEvent)
event := webHook.(*github.PullRequestEvent)
if event.GetAction() == "closed" {
return &ProcessResult{RepoID: event.Repo.GetID(), SHA: event.PullRequest.Head.GetSHA()}, nil
}
return &ProcessResult{RepoID: event.Repo.GetID(), SHA: event.PullRequest.Head.GetSHA(), Merge: true}, nil
case PullRequestReviewEvent:
event := webHook.(github.PullRequestReviewEvent)
event := webHook.(*github.PullRequestReviewEvent)
return &ProcessResult{RepoID: event.Repo.GetID(), SHA: event.PullRequest.Head.GetSHA(), Merge: true}, nil
case PushEvent:
event := webHook.(github.PushEvent)
event := webHook.(*github.PushEvent)
return &ProcessResult{RepoID: event.Repo.GetID(), Update: true, UpdatedRef: event.GetRef()}, nil
case PingEvent:
return &ProcessResult{}, nil
Expand Down

0 comments on commit 2ae38d4

Please sign in to comment.