private GitHubPRCause checkComment(GitHubPRDecisionContext prDecisionContext, GHIssueComment issueComment, GitHubPRUserRestriction userRestriction, TaskListener listener) { GitHubPRCause cause = null; try { String body = issueComment.getBody(); if (isNull(userRestriction) || userRestriction.isWhitelisted(issueComment.getUser())) { final Matcher matcher = Pattern.compile(comment).matcher(body); if (matcher.matches()) { listener.getLogger().println(DISPLAY_NAME + ": matching comment " + body); LOG.trace("Event matches comment '{}'", body); cause = prDecisionContext.newCause("Comment matches to criteria.", false); cause.withCommentBody(body); if (matcher.groupCount() > 0) { cause.withCommentBodyMatch(matcher.group(1)); } } } } catch (IOException ex) { LOG.error("Couldn't check comment #{}, skipping it.", issueComment.getId(), ex); } return cause; }
private boolean findAndDeleteOthers(@Nullable String markup) throws IOException { boolean found = false; for (GHIssueComment comment : pr.listComments()) { if (myself.equals(comment.getUser().getLogin())) { if (markup == null || found || !markup.equals(comment.getBody())) { comment.delete(); continue; } if (markup.equals(comment.getBody())) { found = true; } } } return found; }
public static String updateBotIssuePendingChangesComment(CommandContext context, GHIssueComment comment) throws IOException { GHUser user = comment.getUser(); if (user != null) { if (Objects.equal(context.getConfiguration().getGithubUsername(), user.getLogin())) { String body = comment.getBody(); if (body != null) { body = body.trim(); if (body.startsWith(PENDING_CHANGE_COMMENT_PREFIX)) { return body; } } } } return null; }
private String updateBotCommentCommand(CommandContext context, GHIssueComment comment) throws IOException { GHUser user = comment.getUser(); if (user != null) { if (Objects.equal(context.getConfiguration().getGithubUsername(), user.getLogin())) { String body = comment.getBody(); if (body != null) { body = body.trim(); if (body.startsWith(PullRequests.COMMAND_COMMENT_PREFIX)) { return body; } } } } return null; }
private String updateBotCommentCommand(CommandContext context, GHIssueComment comment) throws IOException { GHUser user = comment.getUser(); if (user != null) { if (Objects.equal(context.getConfiguration().getGithubUsername(), user.getLogin())) { String body = comment.getBody(); if (body != null) { body = body.trim(); if (body.startsWith(PullRequests.COMMAND_COMMENT_PREFIX)) { return body; } } } } return null; }
public static String updateBotIssuePendingChangesComment(CommandContext context, GHIssueComment comment) throws IOException { GHUser user = comment.getUser(); if (user != null) { if (Objects.equal(context.getConfiguration().getGithubUsername(), user.getLogin())) { String body = comment.getBody(); if (body != null) { body = body.trim(); if (body.startsWith(PENDING_CHANGE_COMMENT_PREFIX)) { return body; } } } } return null; }
void onIssueCommentHook(IssueComment issueComment) throws IOException { if (!trigger.isActive()) { LOGGER.log(Level.FINE, "Not checking comments since build is disabled"); return; } int number = issueComment.getIssue().getNumber(); LOGGER.log(Level.FINER, "Comment on issue #{0} from {1}: {2}", new Object[] {number, issueComment.getComment().getUser(), issueComment.getComment().getBody()}); if (!"created".equals(issueComment.getAction())) { return; } GhprbPullRequest pull = getPullRequest(null, number); pull.check(issueComment.getComment()); try { this.save(); } catch (IOException e) { LOGGER.log(Level.SEVERE, "Unable to save repository!", e); } }
private void checkComment(GHIssueComment comment) throws IOException { GHUser sender = comment.getUser(); String body = comment.getBody();
String user = comment != null ? comment.getUser().getName() : ghpr.getUser().getName(); LOGGER.log( Level.INFO,