diff --git a/src/main/java/com/gitee/jenkins/trigger/handler/AbstractWebHookTriggerHandler.java b/src/main/java/com/gitee/jenkins/trigger/handler/AbstractWebHookTriggerHandler.java index 096628a..28d6576 100644 --- a/src/main/java/com/gitee/jenkins/trigger/handler/AbstractWebHookTriggerHandler.java +++ b/src/main/java/com/gitee/jenkins/trigger/handler/AbstractWebHookTriggerHandler.java @@ -85,16 +85,17 @@ public abstract class AbstractWebHookTriggerHandler implement protected abstract BuildStatusUpdate retrieveBuildStatusUpdate(H hook); protected URIish retrieveUrIish(WebHook hook, GitSCM gitSCM) { - if (gitSCM == null) { + if (hook.getRepository() == null) { return null; } - List uris = new ArrayList(); try { - if (hook.getRepository() != null) { - uris.add(new URIish(hook.getRepository().getUrl())); - uris.add(new URIish(hook.getRepository().getGitHttpUrl())); - uris.add(new URIish(hook.getRepository().getGitSshUrl())); + if (gitSCM == null) { + return new URIish(hook.getRepository().getGitHttpUrl()); } + List uris = new ArrayList(); + uris.add(new URIish(hook.getRepository().getUrl())); + uris.add(new URIish(hook.getRepository().getGitHttpUrl())); + uris.add(new URIish(hook.getRepository().getGitSshUrl())); // uri 需与当前项目仓库个url一致,避免触发多个构建 for (RemoteConfig remote : gitSCM.getRepositories()) { for (URIish remoteURL : remote.getURIs()) { diff --git a/src/main/java/com/gitee/jenkins/trigger/handler/note/NoteHookTriggerHandlerImpl.java b/src/main/java/com/gitee/jenkins/trigger/handler/note/NoteHookTriggerHandlerImpl.java index a57f4e6..e8ce65c 100644 --- a/src/main/java/com/gitee/jenkins/trigger/handler/note/NoteHookTriggerHandlerImpl.java +++ b/src/main/java/com/gitee/jenkins/trigger/handler/note/NoteHookTriggerHandlerImpl.java @@ -139,8 +139,8 @@ class NoteHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler private String retrieveRevisionToBuild(NoteHook hook) throws NoRevisionToBuildException { if (hook.getPullRequest() != null - && hook.getPullRequest().getMergeReferenceName() != null) { - return hook.getPullRequest().getMergeReferenceName(); + && hook.getPullRequest().getMergeCommitSha() != null) { + return hook.getPullRequest().getMergeCommitSha(); } else { throw new NoRevisionToBuildException(); } diff --git a/src/main/java/com/gitee/jenkins/trigger/handler/pull/PullRequestHookTriggerHandlerImpl.java b/src/main/java/com/gitee/jenkins/trigger/handler/pull/PullRequestHookTriggerHandlerImpl.java index 54271e2..a91d985 100644 --- a/src/main/java/com/gitee/jenkins/trigger/handler/pull/PullRequestHookTriggerHandlerImpl.java +++ b/src/main/java/com/gitee/jenkins/trigger/handler/pull/PullRequestHookTriggerHandlerImpl.java @@ -203,8 +203,8 @@ class PullRequestHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler