Class GitHubRepositoryName

java.lang.Object
com.cloudbees.jenkins.GitHubRepositoryName

public class GitHubRepositoryName extends Object
Uniquely identifies a repository on GitHub.
Author:
Kohsuke Kawaguchi
  • Field Details

    • host

      public final String host
    • userName

      public final String userName
    • repositoryName

      public final String repositoryName
  • Constructor Details

    • GitHubRepositoryName

      public GitHubRepositoryName(String host, String userName, String repositoryName)
  • Method Details

    • create

      @CheckForNull public static GitHubRepositoryName create(String url)
      Create GitHubRepositoryName from URL
      Parameters:
      url - repo url. Can be null
      Returns:
      parsed GitHubRepositoryName or null if it cannot be parsed from the specified URL
    • create

      @CheckForNull public static GitHubRepositoryName create(GithubProjectProperty projectProperty)
      Parameters:
      projectProperty - project property to extract url. Can be null
      Returns:
      parsed as GitHubRepositoryName object url to GitHub project
      Since:
      1.14.1
      See Also:
    • getHost

      public String getHost()
    • getUserName

      public String getUserName()
    • getRepositoryName

      public String getRepositoryName()
    • resolve

      public Iterable<org.kohsuke.github.GHRepository> resolve()
      Resolves this name to the actual reference by GHRepository Shortcut for resolve(Predicate) with always true predicate (Predicates.alwaysTrue()) as argument
    • resolve

      public Iterable<org.kohsuke.github.GHRepository> resolve(com.google.common.base.Predicate<GitHubServerConfig> predicate)
      Resolves this name to the actual reference by GHRepository. Since the system can store multiple credentials, and only some of them might be able to see this name in question, this method uses GitHubPluginConfig.findGithubConfig(Predicate) and attempt to find the right credential that can access this repository. Any predicate as argument will be combined with GitHubServerConfig.withHost(String) to find only corresponding for this repo name authenticated github repository This method walks multiple repositories for each credential that can access the repository. Depending on what you are trying to do with the repository, you might have to keep trying until a GHRepository with suitable permission is returned.
      Parameters:
      predicate - helps to filter only useful for resolve GitHubServerConfigs
      Returns:
      iterable with lazy login process for getting authenticated repos
      Since:
      1.13.0
    • resolveOne

      @CheckForNull public org.kohsuke.github.GHRepository resolveOne()
      Variation of resolve() method that just returns the first valid repository object. This is useful if the caller only relies on the read access to the repository and doesn't need to walk possible candidates.
    • matches

      public boolean matches(org.kohsuke.github.GHCommitPointer commit)
      Does this repository match the repository referenced in the given GHCommitPointer?
    • matches

      public boolean matches(org.kohsuke.github.GHRepository repo) throws IOException
      Does this repository match the repository referenced in the given GHCommitPointer?
      Throws:
      IOException
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object