commentOnRequest("Pull request is not mergeable.");
return false;
}
GHUser triggerSender = cause.getTriggerSender();
// ignore comments from bot user, this fixes an issue where the bot would auto-merge
// a PR when the 'request for testing' phrase contains the PR merge trigger phrase and
// the bot is a member of a whitelisted organisation
if (helper.isBotUser(triggerSender)) {
logger.println("Comment from bot user " + triggerSender.getLogin() + " ignored.");
return false;
}
boolean merge = true;
if (isOnlyAdminsMerge() && !helper.isAdmin(triggerSender)){
merge = false;
logger.println("Only admins can merge this pull request, " + triggerSender.getLogin() + " is not an admin.");
commentOnRequest(
String.format("Code not merged because %s is not in the Admin list.",
triggerSender.getName()));
}
if (isOnlyTriggerPhrase() && !helper.isTriggerPhrase(cause.getCommentBody())) {
merge = false;
logger.println("The comment does not contain the required trigger phrase.");
commentOnRequest(
String.format("Please comment with '%s' to automerge this request",
trigger.getTriggerPhrase()));
}
if (isDisallowOwnCode() && isOwnCode(pr, triggerSender)) {
merge = false;
logger.println("The commentor is also one of the contributors.");
commentOnRequest(
String.format("Code not merged because %s has committed code in the request.",
triggerSender.getName()));
}
if (merge) {
logger.println("Merging the pull request");