Skip to content

Commit

Permalink
Use Server eventKey for Server Action
Browse files Browse the repository at this point in the history
  • Loading branch information
RMadsenG committed Nov 22, 2024
1 parent c5915fa commit ad14730
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit ad14730

Please sign in to comment.