public GitHubber(String accessToken) { this.accessToken = accessToken; gitHubClient = new GitHubClient(); gitHubClient.setOAuth2Token(accessToken); repositoryService = new RepositoryService(gitHubClient); }
public RepositoryMinerV3(final IGitHubClient ghc) { super(); service = new RepositoryService(ghc); }
public RepositoryService getRespositoryService(String username, String password) throws IOException { return new RepositoryService(getGitHubClient(username, password)); }
@Override public List<String> getRepositories() { // Logging logger.debug("[github] Getting repository list"); // Getting a client GitHubClient client = createGitHubClient(); // Service RepositoryService repositoryService = new RepositoryService(client); // Gets the repository names try { return repositoryService.getRepositories().stream() .map(Repository::getName) .collect(Collectors.toList()); } catch (IOException e) { throw new OntrackGitHubClientException(e); } }
public PublishHelper(CommitterInfo parameterObject,String commitMessage, RepositoryId id) { cl = new GitHubClient(); cl.setCredentials(parameterObject.login, parameterObject.password); rs = new RepositoryService(cl); service = new DataService(cl); this.email=parameterObject.email; this.name=parameterObject.name; this.commitMessage=commitMessage; this.id=id; }
public AbstractGitHubConsumer(GitHubEndpoint endpoint, Processor processor) throws Exception { super(endpoint, processor); this.endpoint = endpoint; Registry registry = endpoint.getCamelContext().getRegistry(); Object service = registry.lookupByName(GitHubConstants.GITHUB_REPOSITORY_SERVICE); if (service != null) { LOG.debug("Using RepositoryService found in registry {}", service.getClass().getCanonicalName()); repositoryService = (RepositoryService) service; } else { repositoryService = new RepositoryService(); } initService(repositoryService); repository = repositoryService.getRepository(endpoint.getRepoOwner(), endpoint.getRepoName()); }
/** * @inheritDoc */ @Override public PullRequest getPullRequestIfExists(String base, String head, String repository) { RepositoryService repositoryService = new RepositoryService(); org.eclipse.egit.github.core.Repository openmrs = null; boolean exists = false; try { openmrs = repositoryService.getRepository(OPENMRS_USER, repository); PullRequestService pullRequestService = new PullRequestService(); List<PullRequest> openPRs = pullRequestService.getPullRequests(openmrs, "open"); for(PullRequest openPR : openPRs){ if(matchPullRequest(base, head, openPR)){ return openPR; } } } catch (IOException e) { throw new RuntimeException("Failed to access remote repository data",e); } return null; }
RepositoryService repoService = new RepositoryService(client); List<Repository> repositories = null; if (org.equals(userLogin)) {
private void forkRepo(String repoName, String repoOwner) { wizard.showMessage("Forking " + repoName + " from " + repoOwner); GitHubClient client = new GitHubClient(); client.setCredentials(githubUsername, githubPassword); RepositoryService service = new RepositoryService(); service.getClient().setCredentials(githubUsername, githubPassword); RepositoryId toBeForked = new RepositoryId(repoOwner, repoName); try { service.forkRepository(toBeForked); } catch (IOException e) { throw new IllegalStateException("Failed to fork repository", e); } }
/** * @see io.apicurio.hub.api.github.IGitHubSourceConnector#getBranches(java.lang.String, java.lang.String) */ @Override public Collection<SourceCodeBranch> getBranches(String org, String repo) throws GitHubException, SourceConnectorException { logger.debug("Getting the branches from {} / {}", org, repo); Collection<SourceCodeBranch> rval = new HashSet<>(); try { GitHubClient client = githubClient(); RepositoryService repoService = new RepositoryService(client); Repository repository = repoService.getRepository(org, repo); List<RepositoryBranch> branches = repoService.getBranches(repository); for (RepositoryBranch branch : branches) { SourceCodeBranch ghBranch = new SourceCodeBranch(); ghBranch.setName(branch.getName()); ghBranch.setCommitId(branch.getCommit().getSha()); rval.add(ghBranch); } } catch (IOException e) { logger.error("Error getting GitHub branches.", e); throw new GitHubException("Error getting GitHub branches.", e); } return rval; }
@WorkerThread public List<Repository> getRepositories() throws IOException { org.eclipse.egit.github.core.service.RepositoryService service = new org.eclipse.egit.github.core.service.RepositoryService(); service.getClient().setOAuth2Token(getAccessToken().getToken()); return service.getRepositories(); } }
public AbstractGitHubProducer(GitHubEndpoint endpoint) throws Exception { super(endpoint); this.endpoint = endpoint; Registry registry = endpoint.getCamelContext().getRegistry(); Object service = registry.lookupByName(GitHubConstants.GITHUB_REPOSITORY_SERVICE); if (service != null) { repositoryService = (RepositoryService) service; } else { repositoryService = new RepositoryService(); } initService(repositoryService); repository = repositoryService.getRepository(endpoint.getRepoOwner(), endpoint.getRepoName()); }
/** * @inheritDoc */ @Override public PullRequest openPullRequest(GithubPrRequest request) { RepositoryService repositoryService = new RepositoryService(); repositoryService.getClient().setCredentials(request.getUsername(), request.getPassword()); org.eclipse.egit.github.core.Repository openmrs = null; try { openmrs = repositoryService.getRepository(OPENMRS_USER, request.getRepository()); } catch (IOException e) { throw new RuntimeException("Failed to get repository data", e); } PullRequestService pullRequestService = new PullRequestService(); pullRequestService.getClient().setCredentials(request.getUsername(), request.getPassword()); PullRequest pr = new org.eclipse.egit.github.core.PullRequest(); pr.setTitle(request.getTitle()); pr.setHead(new PullRequestMarker().setLabel(request.getHead())); pr.setBase(new PullRequestMarker().setLabel(request.getBase())); pr.setBody(request.getDescription()); try { return pullRequestService.createPullRequest(openmrs, pr); } catch (IOException e) { throw new RuntimeException("Failed to create pull request:"+pr, e); } }