Skip to content

Commit

Permalink
feat: add new bitbucket server webhook event type pr:from_ref_updated (
Browse files Browse the repository at this point in the history
  • Loading branch information
kuzm1ch authored and krrrr38 committed Dec 16, 2022
1 parent 5ab9478 commit 691c387
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion server/controllers/events/events_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func (e *VCSEventsController) handleBitbucketServerPost(w http.ResponseWriter, r
}
}
switch eventType {
case bitbucketserver.PullCreatedHeader, bitbucketserver.PullMergedHeader, bitbucketserver.PullDeclinedHeader, bitbucketserver.PullDeletedHeader:
case bitbucketserver.PullCreatedHeader, bitbucketserver.PullFromRefUpdatedHeader, bitbucketserver.PullMergedHeader, bitbucketserver.PullDeclinedHeader, bitbucketserver.PullDeletedHeader:
e.Logger.Debug("handling as pull request state changed event")
e.handleBitbucketServerPullRequestEvent(w, eventType, body, reqID)
return
Expand Down
4 changes: 3 additions & 1 deletion server/events/event_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,9 @@ func (e *EventParser) ParseGitlabMergeRequest(mr *gitlab.MergeRequest, baseRepo
// event given the Bitbucket Server header.
func (e *EventParser) GetBitbucketServerPullEventType(eventTypeHeader string) models.PullRequestEventType {
switch eventTypeHeader {
case bitbucketserver.PullCreatedHeader:
// PullFromRefUpdatedHeader event occurs on OPEN state pull request
// so no additional checks are needed.
case bitbucketserver.PullCreatedHeader, bitbucketserver.PullFromRefUpdatedHeader:
return models.OpenedPullEvent
case bitbucketserver.PullMergedHeader, bitbucketserver.PullDeclinedHeader, bitbucketserver.PullDeletedHeader:
return models.ClosedPullEvent
Expand Down
1 change: 1 addition & 0 deletions server/events/vcs/bitbucketserver/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package bitbucketserver
const (
DiagnosticsPingHeader = "diagnostics:ping"
PullCreatedHeader = "pr:opened"
PullFromRefUpdatedHeader = "pr:from_ref_updated"
PullMergedHeader = "pr:merged"
PullDeclinedHeader = "pr:declined"
PullDeletedHeader = "pr:deleted"
Expand Down

0 comments on commit 691c387

Please sign in to comment.