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;
}
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) {
}
}
}
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;
}
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()));
});
}
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();
}
}
Aggregations