Compare commits

..

9 Commits

Author SHA1 Message Date
Dean Karn f2acbcde40 Update README.md 2018-03-21 08:13:12 -07:00
Dean Karn 3ad83a882d Update README.md 2018-03-21 08:12:58 -07:00
Dean Karn 32331e68eb Merge pull request #27 from lukepatrick/v3
fix(bitbucket) typo in Event
2018-03-21 08:12:28 -07:00
lukepatrick 1253715fd8 fix(bitbucket) typo in Event 2018-03-20 11:20:36 -06:00
Dean Karn 1b6492ce45 Merge pull request #26 from kuiro5/add-requested-reviewers
Add RequestedReviewers to PullRequestPayload
2018-03-19 08:41:56 -07:00
kuiros ea44f6921c Add RequestedReviewers to PullRequestPayload 2018-03-10 15:33:16 -08:00
Dean Karn b6e930d373 Update README.md 2018-02-23 05:13:07 -08:00
Dean Karn c271ec3e32 Merge pull request #25 from lukepatrick/v3
Update bitbucket uuid check to allow a non-specified uuid, similar to…
2018-02-23 05:10:58 -08:00
lukepatrick 0c4911f7f5 Update bitbucket uuid check to allow a non-specified uuid, similar to gitlab empty secret. 2018-02-22 15:27:54 -07:00
3 changed files with 43 additions and 20 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
Library webhooks Library webhooks
================ ================
<img align="right" src="https://raw.githubusercontent.com/go-playground/webhooks/v3/logo.png">![Project status](https://img.shields.io/badge/version-3.6.0-green.svg) <img align="right" src="https://raw.githubusercontent.com/go-playground/webhooks/v3/logo.png">![Project status](https://img.shields.io/badge/version-3.10.0-green.svg)
[![Build Status](https://travis-ci.org/go-playground/webhooks.svg?branch=v3)](https://travis-ci.org/go-playground/webhooks) [![Build Status](https://travis-ci.org/go-playground/webhooks.svg?branch=v3)](https://travis-ci.org/go-playground/webhooks)
[![Coverage Status](https://coveralls.io/repos/go-playground/webhooks/badge.svg?branch=v3&service=github)](https://coveralls.io/github/go-playground/webhooks?branch=v3) [![Coverage Status](https://coveralls.io/repos/go-playground/webhooks/badge.svg?branch=v3&service=github)](https://coveralls.io/github/go-playground/webhooks?branch=v3)
[![Go Report Card](https://goreportcard.com/badge/go-playground/webhooks)](https://goreportcard.com/report/go-playground/webhooks) [![Go Report Card](https://goreportcard.com/badge/go-playground/webhooks)](https://goreportcard.com/report/go-playground/webhooks)
+9 -5
View File
@@ -43,7 +43,7 @@ const (
PullRequestDeclinedEvent Event = "pullrequest:rejected" PullRequestDeclinedEvent Event = "pullrequest:rejected"
PullRequestCommentCreatedEvent Event = "pullrequest:comment_created" PullRequestCommentCreatedEvent Event = "pullrequest:comment_created"
PullRequestCommentUpdatedEvent Event = "pullrequest:comment_updated" PullRequestCommentUpdatedEvent Event = "pullrequest:comment_updated"
PullRequestCommentDeletedEvent Event = "pull_request:comment_deleted" PullRequestCommentDeletedEvent Event = "pullrequest:comment_deleted"
) )
// New creates and returns a WebHook instance denoted by the Provider type // New creates and returns a WebHook instance denoted by the Provider type
@@ -80,10 +80,14 @@ func (hook Webhook) ParsePayload(w http.ResponseWriter, r *http.Request) {
} }
webhooks.DefaultLog.Debug(fmt.Sprintf("X-Hook-UUID:%s", uuid)) webhooks.DefaultLog.Debug(fmt.Sprintf("X-Hook-UUID:%s", uuid))
if uuid != hook.uuid { if len(hook.uuid) > 0 {
webhooks.DefaultLog.Error(fmt.Sprintf("X-Hook-UUID does not match configured uuid of %s", hook.uuid)) if uuid != hook.uuid {
http.Error(w, "403 Forbidden - X-Hook-UUID does not match", http.StatusForbidden) webhooks.DefaultLog.Error(fmt.Sprintf("X-Hook-UUID %s does not match configured uuid of %s", uuid, hook.uuid))
return http.Error(w, "403 Forbidden - X-Hook-UUID does not match", http.StatusForbidden)
return
}
} else {
webhooks.DefaultLog.Debug("hook uuid not defined - recommend setting for improved security")
} }
event := r.Header.Get("X-Event-Key") event := r.Header.Get("X-Event-Key")
+33 -14
View File
@@ -2759,20 +2759,39 @@ type PullRequestPayload struct {
Type string `json:"type"` Type string `json:"type"`
SiteAdmin bool `json:"site_admin"` SiteAdmin bool `json:"site_admin"`
} `json:"user"` } `json:"user"`
Body string `json:"body"` Body string `json:"body"`
CreatedAt time.Time `json:"created_at"` CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"` UpdatedAt time.Time `json:"updated_at"`
ClosedAt *time.Time `json:"closed_at"` ClosedAt *time.Time `json:"closed_at"`
MergedAt *time.Time `json:"merged_at"` MergedAt *time.Time `json:"merged_at"`
MergeCommitSha *string `json:"merge_commit_sha"` MergeCommitSha *string `json:"merge_commit_sha"`
Assignee *Assignee `json:"assignee"` Assignee *Assignee `json:"assignee"`
Milestone *Milestone `json:"milestone"` Milestone *Milestone `json:"milestone"`
CommitsURL string `json:"commits_url"` CommitsURL string `json:"commits_url"`
ReviewCommentsURL string `json:"review_comments_url"` ReviewCommentsURL string `json:"review_comments_url"`
ReviewCommentURL string `json:"review_comment_url"` ReviewCommentURL string `json:"review_comment_url"`
CommentsURL string `json:"comments_url"` CommentsURL string `json:"comments_url"`
StatusesURL string `json:"statuses_url"` StatusesURL string `json:"statuses_url"`
Head struct { RequestedReviewers []struct {
Login string `json:"login"`
ID int `json:"id"`
AvatarURL string `json:"avatar_url"`
GravatarID string `json:"gravatar_id"`
URL string `json:"url"`
HTMLURL string `json:"html_url"`
FollowersURL string `json:"followers_url"`
FollowingURL string `json:"following_url"`
GistsURL string `json:"gists_url"`
StarredURL string `json:"starred_url"`
SubscriptionsURL string `json:"subscriptions_url"`
OrganizationsURL string `json:"organizations_url"`
ReposURL string `json:"repos_url"`
EventsURL string `json:"events_url"`
ReceivedEventsURL string `json:"received_events_url"`
Type string `json:"type"`
SiteAdmin bool `json:"site_admin"`
} `json:"requested_reviewers,omitempty"`
Head struct {
Label string `json:"label"` Label string `json:"label"`
Ref string `json:"ref"` Ref string `json:"ref"`
Sha string `json:"sha"` Sha string `json:"sha"`