Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BuildCommand: only build active pull-requests #219

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions tfs/src/main/java/hudson/plugins/tfs/model/BuildCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down