public async Task<IEnumerable<string>> GetAllRepositoryNames(string personalAccessToken, string organisation) { var github = new GitHubWrapper(personalAccessToken, userNotifier); var organisationRepos = await github.GetRepositoriesForOrg(organisation); return organisationRepos.Select(r => r.Name); }
private async Task<PullRequest> MakePullRequest(MikesPullRequest highestBranchPR, GitHubWrapper gitHubWrapper, string targetBranch, string shortTargetBranchName) { var currentDescription = this.descriptionWithJiraLink; if (highestBranchPR != null) { currentDescription = "See #" + highestBranchPR.Number; } return await gitHubWrapper.CreatePullRequest(this.branch, this.prTitleHalfway, currentDescription, this.targetUsername, this.targetRepository, targetBranch, shortTargetBranchName); }
// Will place the full description on the first PR in this list, and link to it from the others. public async Task MakeLinkedPullRequests(List<BranchDefinition> pullRequestDefinitions, bool shouldAddJiraLinks, bool shouldSetJiraPendingMerge) { var gitHubWrapper = new GitHubWrapper(this.personalAccessToken, userNotifier); var newPullRequests = new List<MikesPullRequest>(); foreach (var pullRequestDefinition in pullRequestDefinitions) { var pullRequest = await MakePullRequest(newPullRequests.FirstOrDefault(), gitHubWrapper, pullRequestDefinition.Branch, pullRequestDefinition.ShortBranchName); newPullRequests.Add(new MikesPullRequest(pullRequest, pullRequestDefinition.ShortBranchName)); } if (shouldAddJiraLinks) { await JiraWrapper.SubmitComment(jiraBugId, MakeFullJIRAComment(newPullRequests)); } if (shouldSetJiraPendingMerge) { await JiraWrapper.SetPendingMerge(jiraBugId); } }
public async Task<IEnumerable<string>> GetAllBranchNames(string personalAccessToken, string username, string repository) { var github = new GitHubWrapper(personalAccessToken, userNotifier); return (await github.GetBranches(username, repository)).Select(b => b.Name); }