-
Notifications
You must be signed in to change notification settings - Fork 3.2k
/
bitbucketserver.go
36 lines (33 loc) · 1.21 KB
/
bitbucketserver.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
36
package webhook
import (
"net/http"
bitbucketserver "gopkg.in/go-playground/webhooks.v5/bitbucket-server"
)
func bitbucketserverMatch(secret string, r *http.Request) bool {
hook, err := bitbucketserver.New(bitbucketserver.Options.Secret(secret))
if err != nil {
return false
}
_, err = hook.Parse(r,
bitbucketserver.RepositoryReferenceChangedEvent,
bitbucketserver.RepositoryModifiedEvent,
bitbucketserver.RepositoryForkedEvent,
bitbucketserver.RepositoryCommentAddedEvent,
bitbucketserver.RepositoryCommentEditedEvent,
bitbucketserver.RepositoryCommentDeletedEvent,
bitbucketserver.PullRequestOpenedEvent,
bitbucketserver.PullRequestFromReferenceUpdatedEvent,
bitbucketserver.PullRequestModifiedEvent,
bitbucketserver.PullRequestMergedEvent,
bitbucketserver.PullRequestDeclinedEvent,
bitbucketserver.PullRequestDeletedEvent,
bitbucketserver.PullRequestReviewerUpdatedEvent,
bitbucketserver.PullRequestReviewerApprovedEvent,
bitbucketserver.PullRequestReviewerUnapprovedEvent,
bitbucketserver.PullRequestReviewerNeedsWorkEvent,
bitbucketserver.PullRequestCommentAddedEvent,
bitbucketserver.PullRequestCommentEditedEvent,
bitbucketserver.PullRequestCommentDeletedEvent,
)
return err == nil
}