diff options
-rw-r--r-- | src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java index ec13f38..4889dcf 100644 --- a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java +++ b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java @@ -89,6 +89,9 @@ public class BitbucketRepository { private boolean isBuildTarget(BitbucketPullRequestResponseValue pullRequest) { boolean shouldBuild = true; if (pullRequest.getState() != null && pullRequest.getState().equals("OPEN")) { + if (isSkipBuild(pullRequest.getTitle())) { + return false; + } BitbucketPullRequestResponseValueRepository destination = pullRequest.getDestination(); String owner = destination.getRepository().getOwnerName(); String repositoryName = destination.getRepository().getRepositoryName(); @@ -116,4 +119,17 @@ public class BitbucketRepository { } return shouldBuild; } + + private boolean isSkipBuild(String pullRequestTitle) { + String skipPhrases = this.trigger.getCiSkipPhrases(); + if (skipPhrases != null) { + String[] phrases = skipPhrases.split(","); + for(String phrase : phrases) { + if (pullRequestTitle.toLowerCase().contains(phrase.trim().toLowerCase())) { + return true; + } + } + } + return false; + } } |