From 66c0756daf276f214061667ce2b47d036eb3fa8a Mon Sep 17 00:00:00 2001 From: "S.nishio" Date: Wed, 16 Apr 2014 01:51:07 +0900 Subject: repository: add ci skip function --- .../bitbucketpullrequestbuilder/BitbucketRepository.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/main/java/bitbucketpullrequestbuilder') 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; + } } -- cgit v1.2.3