public async Task CreatePostComment(PostComment comment) { await GiveClientWithAppCredentials().ConfigureAwait(false); var master = await GetMasterBranch().ConfigureAwait(false); var branch = await CreateCommentBranch(master).ConfigureAwait(false); var branchInfo = new BranchInfo { MasterBranchName = master.Name, NewBranchRef = branch.Ref, NewBranchName = branch.Ref.Split('/').Last() }; var postWithComment = await AddCommentToFileContents(comment).ConfigureAwait(false); await CreateCommentPullRequest(postWithComment, branchInfo, comment.FilePath).ConfigureAwait(false); }
private async Task CreateCommentPullRequest(FileUpdateInfo fileUpdateInfo, BranchInfo branchInfo, string filePath) { await GitHubClient.Repository.Content.UpdateFile(Owner, RepositoryName, filePath, new UpdateFileRequest("new comment", fileUpdateInfo.UpdatedFileContent, fileUpdateInfo.OriginalFileContentSha, branchInfo.NewBranchRef)).ConfigureAwait(false); await GitHubClient.PullRequest.Create(Owner, RepositoryName, new NewPullRequest("new comment", branchInfo.NewBranchName, branchInfo.MasterBranchName)).ConfigureAwait(false); }