@Override public String getFullName() { return repository.getFullName(); }
@Override public String getFullName() { return repository.getFullName(); }
public GHRepository createFork(GHRepository repo) throws IOException { try { return repo.fork(); } catch (IOException e) { log.error("Could not fork {}", repo.getFullName(), e); } return null; }
private static Exception checkAndDelete(GHRepository repo) { log.info("deleting {}", repo.getFullName()); try { repo.delete(); } catch (Exception e) { return e; } return null; }
/** * Forked repositories have a 'source' attribute that specifies the ultimate source of the forking chain. * * @return * {@link GHRepository} that points to the root repository where this repository is forked * (indirectly or directly) from. Otherwise null. * @see #getParent() */ public GHRepository getSource() throws IOException { if (source == null) return null; if (source.root == null) source = root.getRepository(source.getFullName()); return source; }
public GitHubRepoAction(GHRepository remoteRepository) { super(remoteRepository.getHtmlUrl().toExternalForm()); this.name = remoteRepository.getFullName(); }
protected String getApiRoute() { return "/repos/"+owner.getRepository().getFullName()+"/pulls/comments/"+id; }
public GHRepository createFork(GHRepository repo) throws IOException { try { return repo.fork(); } catch (IOException e) { log.error("Could not fork {}", repo.getFullName(), e); } return null; }
/** * Forked repositories have a 'source' attribute that specifies the ultimate source of the forking chain. * * @return * {@link GHRepository} that points to the root repository where this repository is forked * (indirectly or directly) from. Otherwise null. * @see #getParent() */ public GHRepository getSource() throws IOException { if (source == null) return null; if (source.root == null) source = root.getRepository(source.getFullName()); return source; }
/** * Forked repositories have a 'source' attribute that specifies the ultimate source of the forking chain. * * @return * {@link GHRepository} that points to the root repository where this repository is forked * (indirectly or directly) from. Otherwise null. * @see #getParent() */ public GHRepository getSource() throws IOException { if (source == null) return null; if (source.root == null) source = root.getRepository(source.getFullName()); return source; }
protected String getApiRoute() { return "/repos/"+owner.getRepository().getFullName()+"/pulls/comments/"+id; }
/** * Forked repositories have a 'parent' attribute that specifies the repository this repository * is directly forked from. If we keep traversing {@link #getParent()} until it returns null, that * is {@link #getSource()}. * * @return * {@link GHRepository} that points to the repository where this repository is forked * directly from. Otherwise null. * @see #getSource() */ public GHRepository getParent() throws IOException { if (parent == null) return null; if (parent.root == null) parent = root.getRepository(parent.getFullName()); return parent; }
public void run() { try { trigger.handlePR(pr); } catch (Throwable th) { StringBuilder sb = new StringBuilder(); sb.append("Unable to handle PR# "); sb.append(pr.getNumber()); sb.append(" for repo: "); sb.append(pr.getRepository().getFullName()); LOGGER.log(Level.SEVERE, sb.toString(), th); } } }.start();
public static void deleteUpdateBotBranch(GHRepository ghRepository, String branchName) throws IOException { if (branchName.startsWith("updatebot-")) { //delete as per https://github.com/kohsuke/github-api/pull/164#issuecomment-78391771 //heads needed as per https://developer.github.com/v3/git/refs/#get-a-reference ghRepository.getRef("heads/" + branchName).delete(); LOG.info("deleted branch " + branchName + " for " + ghRepository.getFullName()); } }
public void run() { try { trigger.handleComment(comment); } catch (Exception e) { StringBuilder sb = new StringBuilder(); sb.append("Unable to handle comment for PR# "); sb.append(comment.getIssue().getId()); sb.append(", repo: "); sb.append(comment.getRepository().getFullName()); LOGGER.log(Level.SEVERE, sb.toString(), e); } } }.start();
public void setDefaultBranch(String branchName) throws IOException { ghRepo.setDefaultBranch(branchName); ghRepo = gitHub.getRepository(ghRepo.getFullName()); }
@Override public String fetchHeadSha(GHRepository remoteRepo) throws IOException { GHPullRequest pullRequest = remoteRepo.getPullRequest(prNumber); if (pullRequest == null) { throw new IOException("No PR " + prNumber + " in " + remoteRepo.getFullName()); } return pullRequest.getHead().getSha(); }
private Optional<String> searchCurrentRepoNameWithGHAPI(String slug) { GitHub gitHub; try { gitHub = this.getjTravis().getGithub(); GHRepository repository = gitHub.getRepository(slug); if (repository != null) { return Optional.of(repository.getFullName()); } } catch (IOException e) { getLogger().error("Error while trying to retrieve the repository from slug "+slug, e); } return Optional.empty(); }
@Override public String fetchHeadSha(GHRepository remoteRepo) throws IOException { GHBranch branch = remoteRepo.getBranch(getName()); if (branch == null) { throw new IOException("No branch " + getName() + " in " + remoteRepo.getFullName()); } return branch.getSHA1(); }
@Override public String fetchHeadSha(GHRepository remoteRepo) throws IOException { GHTag tag = GitHubTag.findRemoteTag(remoteRepo, getName()); if (tag == null) { throw new IOException("No tag " + getName() + " in " + remoteRepo.getFullName()); } return tag.getCommit().getSHA1(); }