Skip to content

Commit

Permalink
Merge pull request #51 from recena/JENKINS-34120
Browse files Browse the repository at this point in the history
[JENKINS-34120] Mergeability is not a condition to add a new job linked to a PR
  • Loading branch information
recena committed May 4, 2016
2 parents 4970dbc + fd767d9 commit c6ac815
Showing 1 changed file with 5 additions and 6 deletions.
Expand Up @@ -282,19 +282,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.FALSE.equals(mergeable)) {
listener.getLogger().format(" Not mergeable, but it will be included%n");
}
listener.getLogger().format(" Met criteria%n");
} else {
listener.getLogger().format(" Does not meet criteria%n");
Expand Down

0 comments on commit c6ac815

Please sign in to comment.