Skip to content

Commit

Permalink
[JENKINS-32749] @lanwen's comment was addressed
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuel Recena committed Feb 16, 2016
1 parent 15055a6 commit 4f14b84
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Expand Up @@ -286,9 +286,9 @@ protected void doRetrieve(SCMHeadObserver observer, TaskListener listener, GHRep
if (criteria != null) {
SCMSourceCriteria.Probe probe = getProbe(branchName, "pull request", "refs/pull/" + number + "/head", repo, listener);
if (criteria.isHead(probe, listener)) {
listener.getLogger().format(" Met criteria%n");
listener.getLogger().format(" Met criteria%n%n");
} else {
listener.getLogger().format(" Does not meet criteria%n");
listener.getLogger().format(" Does not meet criteria%n%n");
continue;
}
}
Expand Down
Expand Up @@ -27,6 +27,8 @@
import com.cloudbees.jenkins.GitHubRepositoryName;
import hudson.Extension;
import hudson.model.Job;
import hudson.model.JobProperty;
import hudson.model.JobPropertyDescriptor;
import hudson.security.ACL;
import jenkins.scm.api.SCMSource;
import jenkins.scm.api.SCMSourceOwner;
Expand All @@ -36,6 +38,7 @@
import org.kohsuke.github.GHEvent;

import javax.annotation.Nullable;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
Expand All @@ -54,10 +57,17 @@ public class PullRequestGHEventSubscriber extends GHEventsSubscriber {
private static final Logger LOGGER = Logger.getLogger(PullRequestGHEventSubscriber.class.getName());
private static final Pattern REPOSITORY_NAME_PATTERN = Pattern.compile("https?://([^/]+)/([^/]+)/([^/]+)");


@Override
protected boolean isApplicable(@Nullable Job<?, ?> project) {
return true;
if (project.getParent() instanceof SCMSourceOwner) {
SCMSourceOwner owner = (SCMSourceOwner) project.getParent();
for (SCMSource source : owner.getSCMSources()) {
if (source instanceof GitHubSCMSource) {
return true;
}
}
}
return false;
}

/**
Expand Down

0 comments on commit 4f14b84

Please sign in to comment.