Skip to content

Commit

Permalink
[JENKINS-34120] Mergeability is not a condition to add a new job for …
Browse files Browse the repository at this point in the history
…a PR
  • Loading branch information
recena committed Apr 24, 2016
1 parent 93b6b9e commit df2fc42
Showing 1 changed file with 5 additions and 6 deletions.
Expand Up @@ -281,19 +281,18 @@ private void doRetrieve(SCMHeadObserver observer, TaskListener listener, GHRepos
PullRequestSCMHead head = new PullRequestSCMHead(ghPullRequest);
final String branchName = head.getName();
listener.getLogger().format("%n Checking pull request %s%n", HyperlinkNote.encodeTo(ghPullRequest.getHtmlUrl().toString(), "#" + branchName));
// FYI https://developer.github.com/v3/pulls/#response-1
Boolean mergeable = ghPullRequest.getMergeable();
if (!Boolean.TRUE.equals(mergeable)) {
listener.getLogger().format(" Not mergeable, skipping%n%n");
continue;
}
if (repo.getOwner().equals(ghPullRequest.getHead().getUser())) {
listener.getLogger().format(" Submitted from origin repository, skipping%n%n");
continue;
}
if (criteria != null) {
SCMSourceCriteria.Probe probe = getProbe(branchName, "pull request", "refs/pull/" + head.getNumber() + "/head", repo, listener);
if (criteria.isHead(probe, listener)) {
// FYI https://developer.github.com/v3/pulls/#response-1
Boolean mergeable = ghPullRequest.getMergeable();
if (!Boolean.TRUE.equals(mergeable)) {
listener.getLogger().format(" Not mergeable, but it will included%n");
}
listener.getLogger().format(" Met criteria%n");
} else {
listener.getLogger().format(" Does not meet criteria%n");
Expand Down

0 comments on commit df2fc42

Please sign in to comment.