git: only respond to PR opened event

Probably will need to check this on other events too.
This commit is contained in:
Chris Sexton 2019-10-26 15:07:37 -04:00 committed by Chris Sexton
parent 2694463964
commit 686ba1d662
1 changed files with 5 additions and 0 deletions

View File

@ -118,6 +118,11 @@ func (p *GitPlugin) githubEvent(w http.ResponseWriter, r *http.Request) {
msg = fmt.Sprintf("%s pushed to %s: \n%s", push.Pusher.Name, push.Repository.Name, commits)
case github.PullRequestPayload:
pr := payload.(github.PullRequestPayload)
if pr.Action != "opened" {
w.WriteHeader(200)
fmt.Fprintf(w, "ignoring action %s", pr.Action)
return
}
repo = pr.Repository.Name
msg = fmt.Sprintf("%s opened new pull request \"%s\" on %s: %s",
pr.PullRequest.User.Login,