public static void logOpen(List<GHPullRequest> prs) { for (GHPullRequest pr : prs) { LOG.info("Open Pull Request " + pr.getHtmlUrl()); } } }
public static void logOpen(List<GHPullRequest> prs) { for (GHPullRequest pr : prs) { LOG.info("Open Pull Request " + pr.getHtmlUrl()); } } }
/** * Returns the URL to the Github Pull Request. * This URL is part of the pull request object * * @return the Github Pull Request URL * @throws IOException If unable to connect to GitHub */ public URL getUrl() throws IOException { return getPullRequest().getHtmlUrl(); }
public static boolean isMergeable(GHPullRequest pullRequest) throws IOException { boolean canMerge = false; Boolean mergeable = pullRequest.getMergeable(); GHPullRequest single = null; if (mergeable == null) { single = pullRequest.getRepository().getPullRequest(pullRequest.getNumber()); mergeable = single.getMergeable(); } if (mergeable == null) { LOG.warn("Mergeable flag is still null on pull request " + pullRequest.getHtmlUrl() + " assuming its still mergable. Probably a caching issue and this flag may appear again later"); return true; } if (mergeable != null && mergeable.booleanValue()) { canMerge = true; } return canMerge; }
public static boolean isMergeable(GHPullRequest pullRequest) throws IOException { boolean canMerge = false; Boolean mergeable = pullRequest.getMergeable(); GHPullRequest single = null; if (mergeable == null) { single = pullRequest.getRepository().getPullRequest(pullRequest.getNumber()); mergeable = single.getMergeable(); } if (mergeable == null) { LOG.warn("Mergeable flag is still null on pull request " + pullRequest.getHtmlUrl() + " assuming its still mergable. Probably a caching issue and this flag may appear again later"); return true; } if (mergeable != null && mergeable.booleanValue()) { canMerge = true; } return canMerge; }
/** * Lets load the old command context from comments on the PullRequest so that we can re-run a command to rebase things. */ protected CompositeCommand loadCommandsFromPullRequest(CommandContext context, GHRepository ghRepository, GHPullRequest pullRequest) throws IOException { List<GHIssueComment> comments = pullRequest.getComments(); String lastCommand = null; for (GHIssueComment comment : comments) { String command = updateBotCommentCommand(context, comment); if (command != null) { lastCommand = command; } } if (lastCommand == null) { context.warn(LOG, "No UpdateBot comment found on pull request " + pullRequest.getHtmlUrl() + " so cannot rebase!"); return null; } return parseUpdateBotCommandComment(context, lastCommand); }
/** * Lets load the old command context from comments on the PullRequest so that we can re-run a command to rebase things. */ protected CompositeCommand loadCommandsFromPullRequest(CommandContext context, GHRepository ghRepository, GHPullRequest pullRequest) throws IOException { List<GHIssueComment> comments = pullRequest.getComments(); String lastCommand = null; for (GHIssueComment comment : comments) { String command = updateBotCommentCommand(context, comment); if (command != null) { lastCommand = command; } } if (lastCommand == null) { context.warn(LOG, "No UpdateBot comment found on pull request " + pullRequest.getHtmlUrl() + " so cannot rebase!"); return null; } return parseUpdateBotCommandComment(context, lastCommand); }
@Override public PullRequestStatus apply(GHPullRequest input) { int prID = GHUtils.prIdFrom(input.getDiffUrl().toString()); try { GHUser user = input.getUser(); return new PullRequestStatus(prID, input.getHead().getSha(), mergedSHA, input.getHead().getLabel(), input.getBase().getLabel(), input.getHtmlUrl().toString(), user.getName(), user.getEmail(), input.getBody(), input.getTitle()); } catch (IOException e) { throw new RuntimeException(e); } } };
pr.getTitle(), pr.getBody(), pr.getHtmlUrl().toExternalForm()
PullRequestAction(GHPullRequest pr) { number = pr.getNumber(); url = pr.getHtmlUrl(); title = pr.getTitle(); userLogin = pr.getUser().getLogin(); baseRef = pr.getBase().getRef(); }
public StatusInfo(LocalRepository repository, Status status, GHIssue issue, GHPullRequest pullRequest) { this.repository = repository; this.issue = issue; this.pullRequest = pullRequest; this.issueUrl = (issue != null) ? Strings.toString(issue.getHtmlUrl()) : null; this.pullRequestUrl = (pullRequest != null) ? Strings.toString(pullRequest.getHtmlUrl()) : null; this.cloneUrl = repository.getCloneUrl(); this.issueState = state(issue); this.pullRequestState = state(pullRequest); if (nullOrClosed(issueState) && nullOrClosed(pullRequestState) && status.equals(Status.PENDING)) { status = Status.COMPLETE; } this.status = status; }
public StatusInfo(LocalRepository repository, Status status, GHIssue issue, GHPullRequest pullRequest) { this.repository = repository; this.issue = issue; this.pullRequest = pullRequest; this.issueUrl = (issue != null) ? Strings.toString(issue.getHtmlUrl()) : null; this.pullRequestUrl = (pullRequest != null) ? Strings.toString(pullRequest.getHtmlUrl()) : null; this.cloneUrl = repository.getCloneUrl(); this.issueState = state(issue); this.pullRequestState = state(pullRequest); if (nullOrClosed(issueState) && nullOrClosed(pullRequestState) && status.equals(Status.PENDING)) { status = Status.COMPLETE; } this.status = status; }
title = pr.getTitle(); baseRef = pr.getBase().getRef(); htmlUrl = pr.getHtmlUrl();
boolean fork = !ghRepository.getOwner().equals(pr.getHead().getUser()); listener.getLogger().format("%n Checking pull request %s%n", HyperlinkNote.encodeTo(pr.getHtmlUrl().toString(), "#" + number)); if (strategies.get(fork).isEmpty()) { if (fork) {
context.info(LOG, configuration.colored(Configuration.COLOR_PENDING, "Created pull request " + pullRequest.getHtmlUrl())); context.warn(LOG, "Failed to push branch " + localBranch + " to existing github branch " + remoteRef + " for " + pullRequest.getHtmlUrl()); context.info(LOG, "Updated PR " + pullRequest.getHtmlUrl());
context.info(LOG, configuration.colored(Configuration.COLOR_PENDING, "Created pull request " + pullRequest.getHtmlUrl())); context.warn(LOG, "Failed to push branch " + localBranch + " to existing github branch " + remoteRef + " for " + pullRequest.getHtmlUrl()); context.info(LOG, "Updated PR " + pullRequest.getHtmlUrl());
context.warn(LOG, "Failed to find last commit status for PR " + pullRequest.getHtmlUrl() + " " + e, e); mergePr(pullRequest,message); } catch (IOException e) { context.warn(LOG, "Failed to merge PR " + pullRequest.getHtmlUrl() + " " + e, e);
public void init(int pullRequestNumber, File projectBaseDir) { initGitBaseDir(projectBaseDir); try { GitHub github; if (config.isProxyConnectionEnabled()) { github = new GitHubBuilder().withProxy(config.getHttpProxy()).withEndpoint(config.endpoint()).withOAuthToken(config.oauth()).build(); } else { github = new GitHubBuilder().withEndpoint(config.endpoint()).withOAuthToken(config.oauth()).build(); } setGhRepo(github.getRepository(config.repository())); setPr(ghRepo.getPullRequest(pullRequestNumber)); LOG.info("Starting analysis of pull request: " + pr.getHtmlUrl()); myself = github.getMyself().getLogin(); loadExistingReviewComments(); patchPositionMappingByFile = mapPatchPositionsToLines(pr); } catch (IOException e) { LOG.debug("Unable to perform GitHub WS operation", e); throw MessageException.of("Unable to perform GitHub WS operation: " + e.getMessage()); } }
context.warn(LOG, "Failed to find last commit status for PR " + pullRequest.getHtmlUrl() + " " + e, e);