Skip to content

Commit

Permalink
Feature to support bitbucket PR update event
Browse files Browse the repository at this point in the history
  • Loading branch information
HussainS12 authored Feb 15, 2022
1 parent e465477 commit 9da2c09
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public class BitbucketCloudController extends WebhookController {
private static final String EVENT = "X-Event-Key";
private static final String PUSH = EVENT + "=repo:push";
private static final String MERGE = EVENT + "=pullrequest:created";
private static final String MERGE_UPDATED = EVENT + "=pullrequest:updated";

private final FlowProperties flowProperties;
private final BitBucketProperties properties;
Expand All @@ -77,6 +78,24 @@ public ResponseEntity<EventResponse> pushRequest(
@RequestParam(value = "token") String token

) {
return handleMergeEvent(body, product, controllerRequest, token);
}

/**
* Recieve Pull Request Updated Event
*/
@PostMapping(value = {"/{product}", "/"}, headers = MERGE_UPDATED)
public ResponseEntity<EventResponse> pushRequestupdated(
@RequestBody MergeEvent body,
@PathVariable(value = "product", required = false) String product,
ControllerRequest controllerRequest,
@RequestParam(value = "token") String token

) {
return handleMergeEvent(body,product,controllerRequest,token);
}

public ResponseEntity<EventResponse> handleMergeEvent(MergeEvent body, String product, ControllerRequest controllerRequest, String token){
log.debug("Merge Request body contents are {}",body.toString());
String uid = helperService.getShortUid();
MDC.put(FlowConstants.MAIN_MDC_ENTRY, uid);
Expand Down

0 comments on commit 9da2c09

Please sign in to comment.