Search in sources :

Example 1 with GHRepository

use of org.kohsuke.github.GHRepository in project Robot by fo0.

the class UpdateUtils method getVersion.

public static String getVersion() {
    try {
        GitHub gitHub = GitHub.connectAnonymously();
        GHRepository repository = gitHub.getRepository(CONSTANTS.GITHUB_URI);
        GHRelease latest = repository.getLatestRelease();
        return latest.getTagName().replaceAll("v", "");
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
Also used : GHRepository(org.kohsuke.github.GHRepository) GitHub(org.kohsuke.github.GitHub) IOException(java.io.IOException) GHRelease(org.kohsuke.github.GHRelease)

Example 2 with GHRepository

use of org.kohsuke.github.GHRepository in project blueocean-plugin by jenkinsci.

the class GithubCreationTest method deleteRepository.

/**
 * Cleans up repository after the test has completed.
 *
 * @throws IOException
 */
@After
public void deleteRepository() throws IOException {
    if (deleteRepo) {
        try {
            GHRepository repositoryToDelete = github.getRepository(organization + "/" + repo);
            repositoryToDelete.delete();
            logger.info("Deleted repository " + repo);
        } catch (FileNotFoundException e) {
        }
    }
}
Also used : GHRepository(org.kohsuke.github.GHRepository) FileNotFoundException(java.io.FileNotFoundException)

Example 3 with GHRepository

use of org.kohsuke.github.GHRepository in project github-version-statistics by centic9.

the class BaseSearch method getNonForkRepository.

protected String getNonForkRepository(GitHub github, CharSequence htmlUrl) throws IOException {
    String repo = getRepository(htmlUrl);
    if (repo == null) {
        return null;
    }
    final GHRepository repository = github.getRepository(repo);
    if (repository.isFork()) {
        //System.out.println("Ignoring forked repo " + repo);
        return null;
    }
    return repo;
}
Also used : GHRepository(org.kohsuke.github.GHRepository)

Example 4 with GHRepository

use of org.kohsuke.github.GHRepository in project Gargoyle by callakrsos.

the class GitTest method getGargoyleRepository.

@Test
public void getGargoyleRepository() throws IOException {
    GitHub github = GitHub.connect();
    GHUser user = github.getUser("callakrsos");
    Map<String, GHRepository> repositories = user.getRepositories();
    //Repository를 모두 출력
    Iterator<Entry<String, GHRepository>> iterator = repositories.entrySet().iterator();
    while (iterator.hasNext()) {
        Entry<String, GHRepository> next = iterator.next();
        System.out.println(next.getKey() + " - " + next.getValue().getName());
    }
    //Gargoyle Repository 정보 출력
    GHRepository repository = user.getRepository("Gargoyle");
    System.out.println(repository);
    List<GHContent> directoryContent = repository.getDirectoryContent("/");
    //루트 디렉토리 정보 출력
    directoryContent.forEach(con -> {
        System.out.println(String.format("Path : %s\t\t\tsize : %d\t\t\t\tUrl:%s ", con.getPath(), con.getSize(), con.getUrl()));
    });
}
Also used : Entry(java.util.Map.Entry) GHRepository(org.kohsuke.github.GHRepository) GitHub(org.kohsuke.github.GitHub) GHContent(org.kohsuke.github.GHContent) GHUser(org.kohsuke.github.GHUser) Test(org.junit.Test)

Example 5 with GHRepository

use of org.kohsuke.github.GHRepository in project Rubicon by Rubicon-Bot.

the class CommandFeedback method handle.

public static void handle(MessageReceivedEvent event) {
    if (!reportMap.containsKey(event.getAuthor().getIdLong())) {
        return;
    }
    ReportHolder reportHolder = reportMap.get(event.getAuthor().getIdLong());
    if (event.getMessage().getContentDisplay().contains(reportHolder.title))
        return;
    if (!event.getTextChannel().getId().equals(reportHolder.textChannel.getId()))
        return;
    String description = event.getMessage().getContentDisplay();
    try {
        GitHub gitHub = GitHub.connectUsingOAuth(Info.GITHUB_TOKEN);
        GHRepository repository = gitHub.getOrganization("Rubicon-Bot").getRepository("Rubicon");
        GHIssue issue = repository.createIssue(reportHolder.title).body(ISSUE_HEADER + event.getAuthor().getName() + "#" + event.getAuthor().getDiscriminator() + ISSUE_SUFFIX + description).label("Enhancement").label("Up for grabs").create();
        reportHolder.delete(issue.getHtmlUrl().toString());
        event.getMessage().delete().queue();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : GHRepository(org.kohsuke.github.GHRepository) GitHub(org.kohsuke.github.GitHub) GHIssue(org.kohsuke.github.GHIssue) IOException(java.io.IOException)

Aggregations

GHRepository (org.kohsuke.github.GHRepository)23 GitHub (org.kohsuke.github.GitHub)15 IOException (java.io.IOException)10 ArrayList (java.util.ArrayList)4 GHRelease (org.kohsuke.github.GHRelease)4 File (java.io.File)3 FileNotFoundException (java.io.FileNotFoundException)3 Test (org.junit.Test)3 GHContent (org.kohsuke.github.GHContent)3 GHIssue (org.kohsuke.github.GHIssue)3 NextProtException (org.nextprot.api.commons.exception.NextProtException)3 Cacheable (org.springframework.cache.annotation.Cacheable)3 Semver (com.vdurmont.semver4j.Semver)2 HashMap (java.util.HashMap)2 TaskAction (org.gradle.api.tasks.TaskAction)2 GHPullRequest (org.kohsuke.github.GHPullRequest)2 GHTree (org.kohsuke.github.GHTree)2 GHUser (org.kohsuke.github.GHUser)2 ImmutableSet (com.google.common.collect.ImmutableSet)1 BufferedReader (java.io.BufferedReader)1