Skip to content

Commit

Permalink
Merge pull request #54 from tIGO/master
Browse files Browse the repository at this point in the history
Skip comments on closed PR
  • Loading branch information
DavidTanner committed Sep 26, 2014
2 parents a253f55 + 788af50 commit 80bc463
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.acegisecurity.Authentication;
import org.acegisecurity.context.SecurityContextHolder;
import org.kohsuke.github.GHEventPayload;
import org.kohsuke.github.GHIssueState;
import org.kohsuke.github.GHRepository;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
Expand Down Expand Up @@ -53,6 +54,12 @@ public void doIndex(StaplerRequest req, StaplerResponse resp) {
try {
if ("issue_comment".equals(event)) {
GHEventPayload.IssueComment issueComment = gh.get().parseEventPayload(new StringReader(payload), GHEventPayload.IssueComment.class);
GHIssueState state = issueComment.getIssue().getState();
if (state == GHIssueState.CLOSED) {
logger.log(Level.INFO, "Skip comment on closed PR");
return;
}

for (GhprbRepository repo : getRepos(issueComment.getRepository())) {
logger.log(Level.INFO, "Checking issue comment ''{0}'' for repo {1}", new Object[] {issueComment.getComment(), repo.getName()});
repo.onIssueCommentHook(issueComment);
Expand Down

0 comments on commit 80bc463

Please sign in to comment.