예제 #1
0
 /**
  * @return authorized first {@link GitHub} from global config or null if no any
  * @throws IOException never thrown, but in signature for backward compatibility
  * @deprecated see class javadoc. Now any instance return same GH. Please use new api to fetch
  *     another
  */
 @CheckForNull
 @Deprecated
 public GitHub login() throws IOException {
   return from(GitHubPlugin.configuration()
           .findGithubConfig(Predicates.<GitHubServerConfig>alwaysTrue()))
       .first()
       .orNull();
 }
  private GitHub connect(GitHubRepositoryName gitHubRepoName) {
    Iterator<GitHub> withAuth =
        GitHubPlugin.configuration()
            .findGithubConfig(withHost(gitHubRepoName.getHost()))
            .iterator();

    if (withAuth.hasNext()) {
      return withAuth.next();
    } else {
      LOGGER.warning(
          format("Cannot find any credential for GitHub at {0}", gitHubRepoName.getHost()));
      return null;
    }
  }