diff --git a/src/main/java/org/jenkinsci/plugins/ghprb/GhprbRootAction.java b/src/main/java/org/jenkinsci/plugins/ghprb/GhprbRootAction.java index 66b5c22..3957095 100644 --- a/src/main/java/org/jenkinsci/plugins/ghprb/GhprbRootAction.java +++ b/src/main/java/org/jenkinsci/plugins/ghprb/GhprbRootAction.java @@ -137,14 +137,16 @@ private void handleAction(String event, try { GitHub gh = GitHub.connectAnonymously(); - if (state == GHIssueState.CLOSED) { - LOGGER.log(Level.INFO, "Skip ''{0}'' event on closed PR", event); - return; - } else if (StringUtils.equalsIgnoreCase("issue_comment", event)) { + if (StringUtils.equalsIgnoreCase("issue_comment", event)) { comment = getIssueComment(payload, gh); GHIssueState state = comment.getIssue().getState(); + if (state == GHIssueState.CLOSED) { + LOGGER.log(Level.INFO, "Skip comment on closed PR"); + return; + } + if (!comment.getIssue().isPullRequest()) { LOGGER.log(Level.INFO, "Skip comment on Issue"); return; @@ -159,6 +161,13 @@ private void handleAction(String event, } else if (StringUtils.equalsIgnoreCase("pull_request", event)) { pr = getPullRequest(payload, gh); + GHIssueState state = pr.getPullRequest().getState(); + + if (state == GHIssueState.CLOSED) { + LOGGER.log(Level.INFO, "Skip ''{0}'' event on closed PR", event); + return; + } + repoName = pr.getRepository().getFullName(); LOGGER.log(Level.INFO, "Checking PR #{1} for {0}", new Object[] {repoName, pr.getNumber()});