private async Task <FileUpdateInfo> AddCommentToFileContents(PostComment comment) { var content = await GitHubClient.Repository.Content.GetAllContents(Owner, RepositoryName, comment.FilePath).ConfigureAwait(false); return(new FileUpdateInfo { UpdatedFileContent = content[0].Content + comment.Comment, // TODO: update to deal with inserting comments in their desired format OriginalFileContentSha = content[0].Sha }); }
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); }