From ad1473047e464a96710aeb73ec2df0fa72b8ebeb Mon Sep 17 00:00:00 2001 From: Ryan Madsen Date: Fri, 22 Nov 2024 13:26:16 -0500 Subject: [PATCH] Use Server eventKey for Server Action --- .../action/BitBucketPPRPullRequestServerAction.java | 4 ++-- .../action/BitBucketPPRPullRequestServerActionTest.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/jenkins/plugins/bitbucketpushandpullrequest/action/BitBucketPPRPullRequestServerAction.java b/src/main/java/io/jenkins/plugins/bitbucketpushandpullrequest/action/BitBucketPPRPullRequestServerAction.java index f9659c3..e791937 100644 --- a/src/main/java/io/jenkins/plugins/bitbucketpushandpullrequest/action/BitBucketPPRPullRequestServerAction.java +++ b/src/main/java/io/jenkins/plugins/bitbucketpushandpullrequest/action/BitBucketPPRPullRequestServerAction.java @@ -34,7 +34,7 @@ import java.util.List; import java.util.logging.Logger; -import static io.jenkins.plugins.bitbucketpushandpullrequest.common.BitBucketPPRConst.PULL_REQUEST_MERGED; +import static io.jenkins.plugins.bitbucketpushandpullrequest.common.BitBucketPPRConst.PULL_REQUEST_SERVER_MERGED; import static java.util.Objects.isNull; import static org.apache.commons.lang3.ObjectUtils.isEmpty; @@ -220,7 +220,7 @@ public String getLinkDecline() throws MalformedURLException { @Override public String getLatestCommit() { - if (PULL_REQUEST_MERGED.equalsIgnoreCase(this.bitbucketEvent.getAction())) { + if (PULL_REQUEST_SERVER_MERGED.equalsIgnoreCase(this.bitbucketEvent.getAction())) { return payload.getPullRequest().getMergeCommit().getHash(); } return payload.getServerPullRequest().getFromRef().getLatestCommit(); diff --git a/src/test/java/io/jenkins/plugins/bitbucketpushandpullrequest/action/BitBucketPPRPullRequestServerActionTest.java b/src/test/java/io/jenkins/plugins/bitbucketpushandpullrequest/action/BitBucketPPRPullRequestServerActionTest.java index 645ea1e..624a391 100644 --- a/src/test/java/io/jenkins/plugins/bitbucketpushandpullrequest/action/BitBucketPPRPullRequestServerActionTest.java +++ b/src/test/java/io/jenkins/plugins/bitbucketpushandpullrequest/action/BitBucketPPRPullRequestServerActionTest.java @@ -60,7 +60,7 @@ public void testGetMergeCommit() throws BitBucketPPRPayloadPropertyNotFoundExcep BitBucketPPRPayload payloadMock = mock(BitBucketPPRPayload.class, RETURNS_DEEP_STUBS); when(payloadMock.getPullRequest().getMergeCommit().getHash()).thenReturn("123456"); BitBucketPPRHookEvent event = mock(BitBucketPPRHookEvent.class); - when(event.getAction()).thenReturn("fulfilled"); + when(event.getAction()).thenReturn("merged"); BitBucketPPRPullRequestServerAction action = new BitBucketPPRPullRequestServerAction(payloadMock, event); assertEquals("123456", action.getLatestCommit());