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 void MakeLinkedPullRequests(List<BranchDefinition> pullRequestDefinitions, bool shouldAddJiraLinks, bool shouldSetJiraPendingMerge) { var gitHubWrapper = new GitHubWrapper(this.personalAccessToken); 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) { JiraWrapper.SubmitComment(jiraBugId, MakeFullJIRAComment(newPullRequests)); } if (shouldSetJiraPendingMerge) { JiraWrapper.SetPendingMerge(jiraBugId); } }