-
Notifications
You must be signed in to change notification settings - Fork 3.2k
/
bitbucket.go
35 lines (32 loc) · 961 Bytes
/
bitbucket.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package webhook
import (
"net/http"
"gopkg.in/go-playground/webhooks.v5/bitbucket"
)
func bitbucketMatch(secret string, r *http.Request) bool {
hook, err := bitbucket.New(bitbucket.Options.UUID(secret))
if err != nil {
return false
}
_, err = hook.Parse(r,
bitbucket.RepoPushEvent,
bitbucket.RepoForkEvent,
bitbucket.RepoUpdatedEvent,
bitbucket.RepoCommitCommentCreatedEvent,
bitbucket.RepoCommitStatusCreatedEvent,
bitbucket.RepoCommitStatusUpdatedEvent,
bitbucket.IssueCreatedEvent,
bitbucket.IssueUpdatedEvent,
bitbucket.IssueCommentCreatedEvent,
bitbucket.PullRequestCreatedEvent,
bitbucket.PullRequestUpdatedEvent,
bitbucket.PullRequestApprovedEvent,
bitbucket.PullRequestUnapprovedEvent,
bitbucket.PullRequestMergedEvent,
bitbucket.PullRequestDeclinedEvent,
bitbucket.PullRequestCommentCreatedEvent,
bitbucket.PullRequestCommentUpdatedEvent,
bitbucket.PullRequestCommentDeletedEvent,
)
return err == nil
}