Tabnine Logo
GHMyself.getLogin
Code IndexAdd Tabnine to your IDE (free)

How to use
getLogin
method
in
org.kohsuke.github.GHMyself

Best Java code snippets using org.kohsuke.github.GHMyself.getLogin (Showing top 20 results out of 315)

origin: groupon/DotCi

public String getCurrentLogin() {
  return this.user.getLogin();
}
origin: salesforce/dockerfile-image-update

private void cleanBefore() throws Exception {
  String login = github.getMyself().getLogin();
  List<String> repoNames = Arrays.asList(
      Paths.get(login, NAME).toString(),
      Paths.get(ORG, NAME).toString(),
      Paths.get(login, STORE_NAME).toString());
  for (String repoName : repoNames) {
    TestCommon.checkAndDeleteBefore(repoName, github);
  }
}
origin: salesforce/dockerfile-image-update

  public static void addVersionStoreRepo(GitHub github, List<GHRepository> createdRepos, String storeName) throws IOException {
    String login = github.getMyself().getLogin();
    GHRepository storeRepo = github.getRepository(Paths.get(login, storeName).toString());
    createdRepos.add(storeRepo);
  }
}
origin: kohsuke/github-api

 /**
  * Returns the read-only list of all the public verified keys of the current user.
  *
  * Differently from the getPublicKeys() method, the retrieval of the user's
  * verified public keys does not require any READ/WRITE OAuth Scope to the
  * user's profile.
  *
  * @return
  *      Always non-null.
  */
public List<GHVerifiedKey> getPublicVerifiedKeys() throws IOException {
 return Collections.unmodifiableList(Arrays.asList(root.retrieve().to(
   "/users/" + getLogin() + "/keys", GHVerifiedKey[].class)));
}
origin: jenkinsci/ghprb-plugin

  public String getBotUserLogin() {
    try {
      return trigger.getGitHub().getMyself().getLogin();
    } catch (IOException ex) {
      LOGGER.log(Level.SEVERE, null, ex);
      return null;
    }
  }
}
origin: org.kohsuke/github-api

 /**
  * Returns the read-only list of all the public verified keys of the current user.
  *
  * Differently from the getPublicKeys() method, the retrieval of the user's
  * verified public keys does not require any READ/WRITE OAuth Scope to the
  * user's profile.
  *
  * @return
  *      Always non-null.
  */
public List<GHVerifiedKey> getPublicVerifiedKeys() throws IOException {
 return Collections.unmodifiableList(Arrays.asList(root.retrieve().to(
   "/users/" + getLogin() + "/keys", GHVerifiedKey[].class)));
}
origin: org.sonarsource.sonar-plugins.github/github-api

 /**
  * Returns the read-only list of all the public verified keys of the current user.
  *
  * Differently from the getPublicKeys() method, the retrieval of the user's
  * verified public keys does not require any READ/WRITE OAuth Scope to the
  * user's profile.
  *
  * @return
  *      Always non-null.
  */
public List<GHVerifiedKey> getPublicVerifiedKeys() throws IOException {
 return Collections.unmodifiableList(Arrays.asList(root.retrieve().to(
   "/users/" + getLogin() + "/keys", GHVerifiedKey[].class)));
}
origin: salesforce/dockerfile-image-update

private static void checkAndDeleteBefore(List<String> repoNames, String storeName, GitHub github) throws IOException, InterruptedException {
  String user = github.getMyself().getLogin();
  for (String repoName : repoNames) {
    for (String org : ORGS) {
      checkAndDeleteBefore(Paths.get(user, repoName).toString(), github);
      checkAndDeleteBefore(Paths.get(org, repoName).toString(), github);
    }
  }
  checkAndDeleteBefore(Paths.get(user, storeName).toString(), github);
}
origin: KostyaSha/github-integration-plugin

private static boolean isMyselfUser(GHUser user) {
  boolean ret = false;
  if (isNull(user)) {
    return false;
  }
  try {
    GitHub github = githubFor(URI.create(user.getHtmlUrl().toString()));
    ret = StringUtils.equals(user.getLogin(), github.getMyself().getLogin());
  } catch (IOException e) {
    LOGGER.error("Can't connect retrieve user data from GitHub", e);
  }
  return ret;
}
origin: salesforce/dockerfile-image-update

@Test(dependsOnMethods = {"testIdempotency", "testSameNameAcrossDifferentOrgs"})
public void testStoreUpdate() throws Exception {
  String user = github.getMyself().getLogin();
  GHRepository storeRepo = github.getRepository(Paths.get(user, STORE_NAME).toString());
  String latestCommit = storeRepo.getBranches().get(storeRepo.getDefaultBranch()).getSHA1();
  GHContent store = storeRepo.getFileContent("store.json", latestCommit);
  try (InputStream stream = store.read(); InputStreamReader streamR = new InputStreamReader(stream)) {
    JsonElement json = new JsonParser().parse(streamR);
    assertNotNull(json);
    JsonElement images = json.getAsJsonObject().get("images");
    assertNotNull(images);
    Object image1 = images.getAsJsonObject().get(IMAGE_1);
    assertNotNull(image1);
    Object image2 = images.getAsJsonObject().get(IMAGE_2);
    assertNotNull(image2);
    assertEquals(images.getAsJsonObject().get(IMAGE_1).getAsString(), TAG);
    assertEquals(images.getAsJsonObject().get(IMAGE_2).getAsString(), TAG);
  }
}
origin: groupon/DotCi

public Iterable<GHRepository> getRepositories(final String orgName) {
  try {
    if (orgName.equals(this.user.getLogin())) {
      return this.gh.getMyself().listRepositories();
    } else {
      return this.gh.getOrganization(orgName).listRepositories();
    }
  } catch (final IOException e) {
    throw new RuntimeException(e);
  }
}
origin: com.salesforce.dockerfile-image-update/dockerfile-image-update

public void updateStore(String store, String img, String tag) throws IOException {
  if (store == null) {
    log.info("Image tag store cannot be null. Skipping store update...");
    return;
  }
  log.info("Updating store: {} with image: {} tag: {}...", store, img, tag);
  GHRepository storeRepo;
  try {
    GHMyself myself = gitHubUtil.getMyself();
    String ownerOrg = myself.getLogin();
    storeRepo = gitHubUtil.getRepo(Paths.get(ownerOrg, store).toString());
  } catch (IOException e) {
    storeRepo = gitHubUtil.createPublicRepo(store);
  }
  updateStoreOnGithub(storeRepo, Constants.STORE_JSON_FILE, img, tag);
}
origin: salesforce/dockerfile-image-update

public void updateStore(String store, String img, String tag) throws IOException {
  if (store == null) {
    log.info("Image tag store cannot be null. Skipping store update...");
    return;
  }
  log.info("Updating store: {} with image: {} tag: {}...", store, img, tag);
  GHRepository storeRepo;
  try {
    GHMyself myself = gitHubUtil.getMyself();
    String ownerOrg = myself.getLogin();
    storeRepo = gitHubUtil.getRepo(Paths.get(ownerOrg, store).toString());
  } catch (IOException e) {
    storeRepo = gitHubUtil.createPublicRepo(store);
  }
  updateStoreOnGithub(storeRepo, Constants.STORE_JSON_FILE, img, tag);
}
origin: org.sonarsource.sonar-plugins.github/github-api

/**
 * Gets the {@link GHUser} that represents yourself.
 */
@WithBridgeMethods(GHUser.class)
public GHMyself getMyself() throws IOException {
  requireCredential();
  GHMyself u = retrieve().to("/user", GHMyself.class);
  u.root = this;
  users.put(u.getLogin(), u);
  return u;
}
origin: jenkinsci/ghprb-plugin

@POST
public FormValidation doTestGithubAccess(
    @QueryParameter("serverAPIUrl") final String serverAPIUrl,
    @QueryParameter("credentialsId") final String credentialsId) {
  Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
  try {
    GitHubBuilder builder = getBuilder(null, serverAPIUrl, credentialsId);
    if (builder == null) {
      return FormValidation.error("Unable to look up GitHub credentials using ID: " + credentialsId + "!!");
    }
    GitHub gh = builder.build();
    GHMyself me = gh.getMyself();
    String name = me.getName();
    String email = me.getEmail();
    String login = me.getLogin();
    String comment = String.format("Connected to %s as %s (%s) login: %s", serverAPIUrl, name, email, login);
    return FormValidation.ok(comment);
  } catch (Exception ex) {
    return FormValidation.error("Unable to connect to GitHub API: " + ex);
  }
}
origin: qaprosoft/zafira

@Override
public List<Organization> getOrganizations(String accessToken) throws IOException, ServiceException {
  GitHub gitHub = GitHub.connectUsingOAuth(accessToken);
  List<Organization> organizations = gitHub.getMyself().getAllOrganizations().stream().map(organization -> {
    Organization result = new Organization(organization.getLogin());
    result.setAvatarURL(organization.getAvatarUrl());
    return result;
  }).collect(Collectors.toList());
  Organization myself = new Organization(gitHub.getMyself().getLogin());
  myself.setAvatarURL(gitHub.getMyself().getAvatarUrl());
  organizations.add(myself);
  return organizations;
}
origin: jenkinsci/github-plugin

@RequirePOST
@Restricted(DoNotUse.class) // WebOnly
@SuppressWarnings("unused")
public FormValidation doVerifyCredentials(
    @QueryParameter String apiUrl,
    @QueryParameter String credentialsId) throws IOException {
  Jenkins.getActiveInstance().checkPermission(Jenkins.ADMINISTER);
  GitHubServerConfig config = new GitHubServerConfig(credentialsId);
  config.setApiUrl(apiUrl);
  config.setClientCacheSize(0);
  GitHub gitHub = new GitHubLoginFunction().apply(config);
  try {
    if (gitHub != null && gitHub.isCredentialValid()) {
      return FormValidation.ok("Credentials verified for user %s, rate limit: %s",
          gitHub.getMyself().getLogin(), gitHub.getRateLimit().remaining);
    } else {
      return FormValidation.error("Failed to validate the account");
    }
  } catch (IOException e) {
    return FormValidation.error(e, "Failed to validate the account");
  }
}
origin: gradle.plugin.me.seeber.gradle/gradle-github-config

/**
 * Create the repository on Github
 *
 * @throws IOException if something goes horribly wrong
 */
@TaskAction
public void configureRepository() throws IOException {
  GitHub github = GitHub.connect(null, getGithubToken());
  String user = github.getMyself().getLogin();
  GHRepository repository = null;
  try {
    repository = github.getRepository(user + "/" + getRepositoryName());
  }
  catch (FileNotFoundException e) {
    GHCreateRepositoryBuilder repositoryCreator = github.createRepository(getRepositoryName());
    repository = repositoryCreator.create();
  }
  String description = getRepositoryDescription();
  if (description != null && !description.equals(repository.getDescription())) {
    repository.setDescription(description);
  }
}
origin: me.seeber.gradle/gradle-github-config

/**
 * Create the repository on Github
 *
 * @throws IOException if something goes horribly wrong
 */
@TaskAction
public void configureRepository() throws IOException {
  GitHub github = GitHub.connect(null, getGithubToken());
  String user = github.getMyself().getLogin();
  GHRepository repository = null;
  try {
    repository = github.getRepository(user + "/" + getRepositoryName());
  }
  catch (FileNotFoundException e) {
    GHCreateRepositoryBuilder repositoryCreator = github.createRepository(getRepositoryName());
    repository = repositoryCreator.create();
  }
  String description = getRepositoryDescription();
  if (description != null && !description.equals(repository.getDescription())) {
    repository.setDescription(description);
  }
}
origin: SonarSource/sonar-github

public void init(int pullRequestNumber, File projectBaseDir) {
 initGitBaseDir(projectBaseDir);
 try {
  GitHub github;
  if (config.isProxyConnectionEnabled()) {
   github = new GitHubBuilder().withProxy(config.getHttpProxy()).withEndpoint(config.endpoint()).withOAuthToken(config.oauth()).build();
  } else {
   github = new GitHubBuilder().withEndpoint(config.endpoint()).withOAuthToken(config.oauth()).build();
  }
  setGhRepo(github.getRepository(config.repository()));
  setPr(ghRepo.getPullRequest(pullRequestNumber));
  LOG.info("Starting analysis of pull request: " + pr.getHtmlUrl());
  myself = github.getMyself().getLogin();
  loadExistingReviewComments();
  patchPositionMappingByFile = mapPatchPositionsToLines(pr);
 } catch (IOException e) {
  LOG.debug("Unable to perform GitHub WS operation", e);
  throw MessageException.of("Unable to perform GitHub WS operation: " + e.getMessage());
 }
}
org.kohsuke.githubGHMyselfgetLogin

Popular methods of GHMyself

  • listRepositories
    List repositories of a certain type that are accessible by current authenticated user using the spec
  • getEmail
  • getName
  • getEmails2
    Returns the read-only list of e-mail addresses configured for you. This corresponds to the stuff you
  • getRepository
  • listAllRepositories
  • getAllOrganizations
    Gets the organization that this user belongs to.
  • getAllRepositories
    Gets the all repositories this user owns (public and private).
  • getAvatarUrl
  • listOrgMemberships
    List your organization memberships

Popular in Java

  • Updating database using SQL prepared statement
  • scheduleAtFixedRate (ScheduledExecutorService)
  • compareTo (BigDecimal)
  • scheduleAtFixedRate (Timer)
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now