diff --git a/bitbucket-server/bitbucketserver.go b/bitbucket-server/bitbucketserver.go index e23cbff..7b02d39 100644 --- a/bitbucket-server/bitbucketserver.go +++ b/bitbucket-server/bitbucketserver.go @@ -32,11 +32,12 @@ const ( RepositoryCommentEditedEvent Event = "repo:comment:edited" RepositoryCommentDeletedEvent Event = "repo:comment:deleted" - PullRequestOpenedEvent Event = "pr:opened" - PullRequestModifiedEvent Event = "pr:modified" - PullRequestMergedEvent Event = "pr:merged" - PullRequestDeclinedEvent Event = "pr:declined" - PullRequestDeletedEvent Event = "pr:deleted" + PullRequestOpenedEvent Event = "pr:opened" + PullRequestFromReferenceUpdatedEvent Event = "pr:from_ref_updated" + PullRequestModifiedEvent Event = "pr:modified" + PullRequestMergedEvent Event = "pr:merged" + PullRequestDeclinedEvent Event = "pr:declined" + PullRequestDeletedEvent Event = "pr:deleted" PullRequestReviewerUpdatedEvent Event = "pr:reviewer:updated" PullRequestReviewerApprovedEvent Event = "pr:reviewer:approved" @@ -168,6 +169,10 @@ func (hook *Webhook) Parse(r *http.Request, events ...Event) (interface{}, error var pl PullRequestOpenedPayload err = json.Unmarshal([]byte(payload), &pl) return pl, err + case PullRequestFromReferenceUpdatedEvent: + var pl PullRequestFromReferenceUpdatedPayload + err = json.Unmarshal([]byte(payload), &pl) + return pl, err case PullRequestModifiedEvent: var pl PullRequestModifiedPayload err = json.Unmarshal([]byte(payload), &pl) diff --git a/bitbucket-server/payload.go b/bitbucket-server/payload.go index f409419..9cf46c4 100644 --- a/bitbucket-server/payload.go +++ b/bitbucket-server/payload.go @@ -66,6 +66,14 @@ type PullRequestOpenedPayload struct { PullRequest PullRequest `json:"pullRequest"` } +type PullRequestFromReferenceUpdatedPayload struct { + Date Date `json:"date"` + EventKey Event `json:"eventKey"` + Actor User `json:"actor"` + PullRequest PullRequest `json:"pullRequest"` + PreviousFromHash string `json:"previousFromHash"` +} + type PullRequestModifiedPayload struct { Date Date `json:"date"` EventKey Event `json:"eventKey"`