Skip to content

Commit

Permalink
Filter webhooks originating from pull requests by source branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Lars Hemala committed Nov 9, 2020
1 parent ef2ffc6 commit d78e63a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions modules/webhook/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ var hookQueue = sync.NewUniqueQueue(setting.Webhook.QueueLength)
// getPayloadBranch returns branch for hook event, if applicable.
func getPayloadBranch(p api.Payloader) string {
switch pp := p.(type) {
case *api.PullRequestPayload:
return pp.PullRequest.Head.Ref
case *api.CreatePayload:
if pp.RefType == "branch" {
return pp.Ref
Expand Down

0 comments on commit d78e63a

Please sign in to comment.