From a2da61660ec5a175f52858ef5d9656f8271994cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20B=C3=A4uerle?= Date: Mon, 10 Dec 2018 10:34:45 +0100 Subject: [PATCH] BuildCommand: only build active pull-requests --- .../main/java/hudson/plugins/tfs/model/BuildCommand.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tfs/src/main/java/hudson/plugins/tfs/model/BuildCommand.java b/tfs/src/main/java/hudson/plugins/tfs/model/BuildCommand.java index d1e193d6e..d7844597a 100644 --- a/tfs/src/main/java/hudson/plugins/tfs/model/BuildCommand.java +++ b/tfs/src/main/java/hudson/plugins/tfs/model/BuildCommand.java @@ -3,6 +3,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.microsoft.teamfoundation.sourcecontrol.webapi.model.GitPush; +import com.microsoft.teamfoundation.sourcecontrol.webapi.model.PullRequestStatus; import hudson.model.Action; import hudson.model.BuildableItem; import hudson.model.Cause; @@ -135,6 +136,11 @@ else if (teamBuildPayload.ServiceHookEvent != null) { else if ("git.pullrequest.merged".equals(eventType)) { final GitPullRequestEx gitPullRequest = mapper.convertValue(resource, GitPullRequestEx.class); final PullRequestMergeCommitCreatedEventArgs args = GitPullRequestMergedEvent.decodeGitPullRequest(gitPullRequest, event); + + // only build active pull-requests. + if (gitPullRequest.getStatus() == PullRequestStatus.ACTIVE) + return new JSONObject(); + // record the values for the special optional parameters commitId = args.commit; pullRequestId = Integer.toString(args.pullRequestId, 10);