/** * Creates a new repository. * * @return * Newly created repository. * @deprecated * Use {@link #createRepository(String)} that uses a builder pattern to let you control every aspect. */ public GHRepository createRepository(String name, String description, String homepage, boolean isPublic) throws IOException { return createRepository(name).description(description).homepage(homepage).private_(!isPublic).create(); }
/** * Starts a builder that creates a new repository. * * <p> * You use the returned builder to set various properties, then call {@link GHCreateRepositoryBuilder#create()} * to finally createa repository. */ public GHCreateRepositoryBuilder createRepository(String name) { return new GHCreateRepositoryBuilder(root,"/orgs/"+login+"/repos",name); }
/** * Create a public repo. We cannot make private repos for open source users because they'd be forced to buy a * paid account. * * @param repoName Name of the repository * @return * @throws IOException */ public GHRepository createPublicRepo(String repoName) throws IOException { GHCreateRepositoryBuilder repoBuilder = github.createRepository(repoName); repoBuilder.private_(false); return repoBuilder.create(); }
public static void initializeRepos(GHOrganization org, List<String> repos, String image, List<GHRepository> createdRepos, GitHubUtil gitHubUtil) throws Exception { for (String repoName : repos) { GHRepository repo = org.createRepository(repoName) .description("Delete if this exists. If it exists, then an integration test crashed somewhere.") .private_(false) .create(); // Ensure that repository exists for (int attempts = 0; attempts < 5; attempts++) { try { repo = gitHubUtil.getRepo(repo.getFullName()); break; } catch (Exception e) { log.info("Waiting for {} to be created", repo.getFullName()); Thread.sleep(TimeUnit.SECONDS.toMillis(1)); } } repo.createContent("FROM " + image + ":test", "Integration Testing", "Dockerfile"); createdRepos.add(repo); log.info("Initializing {}/{}", org.getLogin(), repoName); gitHubUtil.tryRetrievingContent(repo, "Dockerfile", repo.getDefaultBranch()); } }
.description("Delete if this exists. If it exists, then an integration test crashed somewhere.") .create(); store.createContent("{\n \"images\": {\n" + " \"" + IMAGE_1 + "\": \"" + TEST_TAG + "\",\n" +
private GHRepository create() throws IOException { GHRepository repo = gitHub.createRepository(repoName).create(); ensureRepositoryCreated(repo, System.currentTimeMillis()); LOG.info("GitHub repo {} has been created", repo.getHtmlUrl()); return repo; }
public GHCreateRepositoryBuilder homepage(URL homepage) { return homepage(homepage.toExternalForm()); }
@BeforeClass public void setUp() throws Exception { String gitApiUrl = System.getenv("git_api_url"); String token = System.getenv("git_api_token"); github = new GitHubBuilder().withEndpoint(gitApiUrl) .withOAuthToken(token) .build(); github.checkApiUrlValidity(); cleanBefore(); gitHubUtil = new GitHubUtil(github); GHOrganization org = github.getOrganization(ORG); GHRepository repo = org.createRepository(NAME) .description("Delete if this exists. If it exists, then an integration test crashed somewhere.") .private_(false) .create(); log.info("Initializing {}", repo.getFullName()); createdRepos.add(repo); repo.createContent("FROM " + IMAGE + ":test", "Integration Testing", "Dockerfile"); }
/** * Create a public repo. We cannot make private repos for open source users because they'd be forced to buy a * paid account. * * @param repoName Name of the repository * @return * @throws IOException */ public GHRepository createPublicRepo(String repoName) throws IOException { GHCreateRepositoryBuilder repoBuilder = github.createRepository(repoName); repoBuilder.private_(false); return repoBuilder.create(); }
/** * Create the repository on Github * * @throws IOException if something goes horribly wrong */ @TaskAction public void configureRepository() throws IOException { GitHub github = GitHub.connect(null, getGithubToken()); String user = github.getMyself().getLogin(); GHRepository repository = null; try { repository = github.getRepository(user + "/" + getRepositoryName()); } catch (FileNotFoundException e) { GHCreateRepositoryBuilder repositoryCreator = github.createRepository(getRepositoryName()); repository = repositoryCreator.create(); } String description = getRepositoryDescription(); if (description != null && !description.equals(repository.getDescription())) { repository.setDescription(description); } }
public GHCreateRepositoryBuilder homepage(URL homepage) { return homepage(homepage.toExternalForm()); }
/** * @deprecated * Use {@link #createRepository(String)} that uses a builder pattern to let you control every aspect. */ public GHRepository createRepository(String name, String description, String homepage, GHTeam team, boolean isPublic) throws IOException { if (team==null) throw new IllegalArgumentException("Invalid team"); return createRepository(name).description(description).homepage(homepage).private_(!isPublic).team(team).create(); }
/** * Create the repository on Github * * @throws IOException if something goes horribly wrong */ @TaskAction public void configureRepository() throws IOException { GitHub github = GitHub.connect(null, getGithubToken()); String user = github.getMyself().getLogin(); GHRepository repository = null; try { repository = github.getRepository(user + "/" + getRepositoryName()); } catch (FileNotFoundException e) { GHCreateRepositoryBuilder repositoryCreator = github.createRepository(getRepositoryName()); repository = repositoryCreator.create(); } String description = getRepositoryDescription(); if (description != null && !description.equals(repository.getDescription())) { repository.setDescription(description); } }
/** * Starts a builder that creates a new repository. * * <p> * You use the returned builder to set various properties, then call {@link GHCreateRepositoryBuilder#create()} * to finally createa repository. */ public GHCreateRepositoryBuilder createRepository(String name) { return new GHCreateRepositoryBuilder(root,"/orgs/"+login+"/repos",name); }
/** * Creates a new repository. * * @return * Newly created repository. * @deprecated * Use {@link #createRepository(String)} that uses a builder pattern to let you control every aspect. */ public GHRepository createRepository(String name, String description, String homepage, boolean isPublic) throws IOException { return createRepository(name).description(description).homepage(homepage).private_(!isPublic).create(); }
/** * Starts a builder that creates a new repository. * * <p> * You use the returned builder to set various properties, then call {@link GHCreateRepositoryBuilder#create()} * to finally createa repository. * * <p> * To create a repository in an organization, see * {@link GHOrganization#createRepository(String, String, String, GHTeam, boolean)} */ public GHCreateRepositoryBuilder createRepository(String name) { return new GHCreateRepositoryBuilder(this,"/user/repos",name); }
/** * @deprecated * Use {@link #createRepository(String)} that uses a builder pattern to let you control every aspect. */ public GHRepository createRepository(String name, String description, String homepage, GHTeam team, boolean isPublic) throws IOException { if (team==null) throw new IllegalArgumentException("Invalid team"); return createRepository(name).description(description).homepage(homepage).private_(!isPublic).team(team).create(); }
/** * Starts a builder that creates a new repository. * * <p> * You use the returned builder to set various properties, then call {@link GHCreateRepositoryBuilder#create()} * to finally createa repository. * * <p> * To create a repository in an organization, see * {@link GHOrganization#createRepository(String, String, String, GHTeam, boolean)} */ public GHCreateRepositoryBuilder createRepository(String name) { return new GHCreateRepositoryBuilder(this,"/user/repos",name); }