Skip to content

Commit

Permalink
Add botreview plug in comment
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Hiller <[email protected]>
  • Loading branch information
dhiller committed Nov 25, 2022
1 parent 80ea593 commit 3561aa3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion external-plugins/botreview/review/review.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,20 @@ func (r *Reviewer) ReviewLocalCode() ([]BotReviewResult, error) {
return results, nil
}

var botReviewCommentPattern = `@%s's review-bot says:
%v
**Note: [botreview](kubevirt/project-infra#2448) is a Work In Progress!**
`

func (r *Reviewer) AttachReviewComments(botReviewResults []BotReviewResult, githubClient github.Client) error {
botUser, err := githubClient.BotUser()
if err != nil {
return fmt.Errorf("error while fetching user data: %v", err)
}
for _, reviewResult := range botReviewResults {
botReviewComment := fmt.Sprintf("@%s's review-bot says:\n\n%v", botUser.Login, reviewResult)
botReviewComment := fmt.Sprintf(botReviewCommentPattern, botUser.Login, reviewResult)
if !r.dryRun {
err = githubClient.CreateComment(r.org, r.repo, r.num, botReviewComment)
if err != nil {
Expand Down

0 comments on commit 3561aa3

Please sign in to comment.