本文整理匯總了Java中org.kohsuke.github.GHRepository.getName方法的典型用法代碼示例。如果您正苦於以下問題:Java GHRepository.getName方法的具體用法?Java GHRepository.getName怎麽用?Java GHRepository.getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.kohsuke.github.GHRepository
的用法示例。
在下文中一共展示了GHRepository.getName方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: GitRepositoryDTO
import org.kohsuke.github.GHRepository; //導入方法依賴的package包/類
public GitRepositoryDTO(String key, GHRepository repository) {
this.id = key;
this.name = repository.getName();
if (Strings.isNullOrBlank(name)) {
name = repository.getFullName();
}
if (Strings.isNullOrBlank(name)) {
name = key;
}
description = repository.getDescription();
if (Strings.isNullOrBlank(description) || key.equals(description)) {
try {
description = createdAtText(repository.getCreatedAt());
} catch (IOException e) {
// ignore
}
}
if (Strings.isNullOrBlank(description)) {
description = repository.getHomepage();
}
}
示例2: doAction
import org.kohsuke.github.GHRepository; //導入方法依賴的package包/類
@Override
public boolean doAction(PullRequest payload) throws IOException {
String action = payload.getAction();
if (action.equals("opened") || action.equals("synchronize")) {
GHRepository repository = payload.getRepository();
Integer prNumber = new Integer(payload.getNumber());
PullRequestImporter prImporter = prImportProvider.get();
String organization = repository.getOwnerName();
String name = repository.getName();
logger.info("Importing {}/{}#{}", organization, name, prNumber);
prImporter.importPullRequest(
0, organization, name, prNumber.intValue(), PullRequestImportType.Commits);
logger.info("Imported {}/{}#{}", organization, name, prNumber);
return true;
}
return false;
}
示例3: deleteRepos
import org.kohsuke.github.GHRepository; //導入方法依賴的package包/類
private void deleteRepos(List<String> lstReposToDelete) throws IOException {
GitHub github = GitHub.connect();
GHMyself me = github.getMyself();
PagedIterable<GHRepository> lstRepos = me.listRepositories();
int cntDeleted = 0;
for (GHRepository repo : lstRepos) {
String name = repo.getName();
if (lstReposToDelete.contains(name)) {
repo.delete();
cntDeleted++;
System.out.format("Deleted: %s\n", name);
}
}
System.out.format("That's %d repositories deleted!\n",
cntDeleted);
}
示例4: mapGhRepository
import org.kohsuke.github.GHRepository; //導入方法依賴的package包/類
private GitHubRepository mapGhRepository(GHRepository gitHubRepository) throws IOException {
String repositoryName = gitHubRepository.getName();
int stars = gitHubRepository.listStargazers().asList().size();
int openPullRequests = gitHubRepository.getPullRequests(GHIssueState.OPEN).size();
int pullRequests =
openPullRequests + gitHubRepository.getPullRequests(GHIssueState.CLOSED).size();
int openIssues = gitHubRepository.getOpenIssueCount();
int branches = gitHubRepository.getBranches().size();
int collaborators = gitHubRepository.getCollaborators().size();
int forks = gitHubRepository.getForks();
int watchers = gitHubRepository.getWatchers();
return new GitHubRepository(repositoryName, stars, openPullRequests, pullRequests, openIssues,
branches, collaborators, forks, watchers);
}
示例5: doAction
import org.kohsuke.github.GHRepository; //導入方法依賴的package包/類
@Override
public void doAction(
IdentifiedUser user,
GitHubLogin hubLogin,
HttpServletRequest req,
HttpServletResponse resp,
ControllerErrors errors)
throws ServletException, IOException {
String organisation = req.getParameter("organisation");
JsonArray jsonRepos = new JsonArray();
int numRepos = 0;
PagedIterator<GHRepository> repoIter = getRepositories(hubLogin, organisation).iterator();
while (repoIter.hasNext() && numRepos < config.repositoryListLimit) {
GHRepository ghRepository = repoIter.next();
if (ghRepository.hasPushAccess() && ghRepository.hasPullAccess()) {
JsonObject repository = new JsonObject();
String projectName = organisation + "/" + ghRepository.getName();
if (projects.get(Project.NameKey.parse(projectName)) == null) {
repository.add("name", new JsonPrimitive(ghRepository.getName()));
repository.add("organisation", new JsonPrimitive(organisation));
repository.add(
"description", new JsonPrimitive(Strings.nullToEmpty(ghRepository.getDescription())));
repository.add("private", new JsonPrimitive(new Boolean(ghRepository.isPrivate())));
jsonRepos.add(repository);
numRepos++;
}
} else {
log.warn(
"Skipping repository {} because user {} has no push/pull access to it",
ghRepository.getName(),
user.getUserName());
}
}
resp.getWriter().println(jsonRepos.toString());
}
示例6: createNewProject
import org.kohsuke.github.GHRepository; //導入方法依賴的package包/類
public DynamicProject createNewProject(final GHRepository githubRepository, final String accessToken, final String user) {
try {
new GithubRepositoryService(githubRepository).linkProjectToCi(accessToken, user);
final OrganizationContainer folder = this.organizationRepository.getOrCreateContainer(githubRepository.getOwner().getLogin());
final String projectName = githubRepository.getName();
final DynamicProject project = folder.createProject(DynamicProject.class, projectName);
project.setDescription(format("<a href=\"%s\">%s</a>", githubRepository.getUrl(), githubRepository.getUrl()));
project.setConcurrentBuild(true);
if (StringUtils.isNotEmpty(SetupConfig.get().getLabel())) {
project.setAssignedLabel(Jenkins.getInstance().getLabel(SetupConfig.get().getLabel()));
}
project.addProperty(new ParametersDefinitionProperty(new GithubBranchParameterDefinition("BRANCH", "master", githubRepository.getHtmlUrl().toString())));
project.addProperty(new GithubRepoProperty(githubRepository.getHtmlUrl().toExternalForm()));
project.addProperty(new BuildTypeProperty(SetupConfig.get().getDefaultBuildType()));
project.addProperty(new DynamicProjectBranchTabsProperty("master"));
project.addProperty(new RebuildSettings(true, false));
project.addProperty(new JobUiProperty(SetupConfig.get().isDefaultToNewUi()));
project.save();
folder.addItem(project);
folder.save();
return project;
} catch (final IOException e) {
throw new RuntimeException(e);
}
}
示例7: run
import org.kohsuke.github.GHRepository; //導入方法依賴的package包/類
private void run() throws IOException {
GitHub github = GitHub.connect();
Map<String, GHOrganization> orgs = github.getMyOrganizations();
System.out.println(orgs);
GHMyself me = github.getMyself();
PagedIterable<GHRepository> lstRepos = me.listRepositories();
// TODO:mgp: Figure out what I am missing here.
int counterSinceThereSeemsToBeNoSizeMethodOnPagedIterable = 0;
GHRepository repoToDelete = null;
PrintWriter outCloneList = new PrintWriter("clone_these.sh");
PrintWriter outRepoList = new PrintWriter("repo_list.txt");
for (GHRepository repo : lstRepos) {
String name = repo.getName();
Date pushedAt = repo.getPushedAt();
String readOnlyUrl = repo.getGitTransportUrl();
outRepoList.format("%s\n", name);
outCloneList.println(readOnlyUrl);
counterSinceThereSeemsToBeNoSizeMethodOnPagedIterable++;
if (name.equals("c-style")) {
repoToDelete = repo;
System.out.println("Well?");
}
}
outCloneList.close();
outRepoList.close();
System.out.format("That's %d repositories!\n",
counterSinceThereSeemsToBeNoSizeMethodOnPagedIterable);
if (null != repoToDelete) {
repoToDelete.delete();
}
}