@@ -37,16 +37,18 @@ func AddReviewComments(repo *Repository, pullRequestID int, client vcsclient.Vcs
37
37
err = errors .New ("couldn't delete pull request comment: " + err .Error ())
38
38
return
39
39
}
40
- // Add review comments for the given data
41
40
commentsToAdd := getNewReviewComments (repo , vulnerabilitiesRows , iacIssues , sastIssues )
42
- if len (commentsToAdd ) > 0 {
43
- for _ , comment := range commentsToAdd {
44
- if e := client .AddPullRequestReviewComments (context .Background (), repo .RepoOwner , repo .RepoName , pullRequestID , comment .CommentInfo ); e != nil {
45
- log .Debug ("couldn't add pull request review comment, fallback to regular comment: " + e .Error ())
46
- if err = client .AddPullRequestComment (context .Background (), repo .RepoOwner , repo .RepoName , getRegularCommentContent (comment ), pullRequestID ); err != nil {
47
- err = errors .New ("couldn't add pull request comment, fallback to comment: " + err .Error ())
48
- return
49
- }
41
+ if len (commentsToAdd ) == 0 {
42
+ return
43
+ }
44
+ // Add review comments for the given data
45
+ for _ , comment := range commentsToAdd {
46
+ log .Debug ("creating a review comment for" , comment .Type , comment .Location .File , comment .Location .StartLine , comment .Location .StartColumn )
47
+ if e := client .AddPullRequestReviewComments (context .Background (), repo .RepoOwner , repo .RepoName , pullRequestID , comment .CommentInfo ); e != nil {
48
+ log .Debug ("couldn't add pull request review comment, fallback to regular comment: " + e .Error ())
49
+ if err = client .AddPullRequestComment (context .Background (), repo .RepoOwner , repo .RepoName , getRegularCommentContent (comment ), pullRequestID ); err != nil {
50
+ err = errors .New ("couldn't add pull request comment, fallback to comment: " + err .Error ())
51
+ return
50
52
}
51
53
}
52
54
}
0 commit comments