@Nullable private static GithubFullPath findRepositoryByUser( @NotNull Project project, @NotNull String user, @NotNull Set<GithubFullPath> forks, @NotNull GithubAuthData auth, @NotNull GithubRepo source) { for (GithubFullPath path : forks) { if (StringUtil.equalsIgnoreCase(user, path.getUser())) { return path; } } try { GithubRepoDetailed target = GithubApiUtil.getDetailedRepoInfo(auth, user, source.getName()); if (target.getSource() != null && StringUtil.equals(target.getSource().getUserName(), source.getUserName())) { return target.getFullPath(); } } catch (IOException ignore) { // such repo may not exist } try { GithubRepo fork = GithubApiUtil.findForkByUser(auth, source.getUserName(), source.getName(), user); if (fork != null) { return fork.getFullPath(); } } catch (IOException e) { GithubNotifications.showError(project, CANNOT_CREATE_PULL_REQUEST, e); } return null; }
@Nullable private static GithubPullRequest createPullRequest( @NotNull Project project, @NotNull GithubAuthData auth, @NotNull GithubFullPath targetRepo, @NotNull String title, @NotNull String description, @NotNull String head, @NotNull String base) { try { return GithubApiUtil.createPullRequest( auth, targetRepo.getUser(), targetRepo.getRepository(), title, description, head, base); } catch (IOException e) { GithubNotifications.showError(project, CANNOT_CREATE_PULL_REQUEST, e); return null; } }
protected void deleteGithubRepo() throws IOException { GithubApiUtil.deleteGithubRepository(myGitHubSettings.getAuthData(), myLogin1, PROJECT_NAME); }