private boolean isGitmodulesFileExist() throws IOException { return 0 < ghRepo .getDirectoryContent("") .stream() .filter(item -> item.getName().equals(".gitmodules")) .count(); }
@NonNull @Override public Iterable<SCMFile> children() throws IOException { checkOpen(); List<GHContent> content = repo.getDirectoryContent(getPath(), ref); List<SCMFile> result = new ArrayList<>(content.size()); for (GHContent c : content) { result.add(new GitHubSCMFile(this, c.getName(), c)); } return result; }
private void handleFile(final List<String> documents, final GitHubLocation location, final GHContent c) { log.debug("handle file={}", c.getPath()); if (StringUtils.endsWith(c.getName(), "md")) { final String name = StringUtils.substringAfter(c.getPath(), location.getPath()); final String listingName = MountPointUtil.apply(location, name); documents.add(listingName); } }
if (content.getName().equals(fileName)) { String repoName = StringUtils.substringAfter(repo.getUrl(), "github.com/");
private void listRepo(final List<String> documents, final GitHubLocation location, final GHRepository repo, final GHBranch branch, final String path) throws IOException { final List<GHContent> content = repo.getDirectoryContent(path, branch.getName()); for (final GHContent c : content) { switch (c.getType()) { case "file": handleFile(documents, location, c); break; case "dir": handleDir(documents, location, repo, branch, c); break; default: log.info("ignoring {}", c.getName()); } } }
protected void modifyOnGithubRecursive(GHRepository repo, GHContent content, String branch, String img, String tag) throws IOException { /* If we have a submodule; we want to skip. Content is submodule when the type is file, but content.getDownloadUrl() is null. */ if (content.isFile() && content.getDownloadUrl() != null) { modifyOnGithub(content, branch, img, tag, ""); } else if(content.isDirectory()) { for (GHContent newContent : repo.getDirectoryContent(content.getPath(), branch)) { modifyOnGithubRecursive(repo, newContent, branch, img, tag); } } else { // The only other case is if we have a file, but content.getDownloadUrl() is null log.info("Skipping submodule {}", content.getName()); } }
protected void modifyOnGithubRecursive(GHRepository repo, GHContent content, String branch, String img, String tag) throws IOException { /* If we have a submodule; we want to skip. Content is submodule when the type is file, but content.getDownloadUrl() is null. */ if (content.isFile() && content.getDownloadUrl() != null) { modifyOnGithub(content, branch, img, tag, ""); } else if(content.isDirectory()) { for (GHContent newContent : repo.getDirectoryContent(content.getPath(), branch)) { modifyOnGithubRecursive(repo, newContent, branch, img, tag); } } else { // The only other case is if we have a file, but content.getDownloadUrl() is null log.info("Skipping submodule {}", content.getName()); } }