chore(workflow): log where a review's comments are placed before posting
This commit is contained in:
1 parent
12b5022a4f
commit
c787db7e07
1 file changed
+5
-4
@@ -731,14 +731,15 @@ func postPRReview(ctx context.Context, tc *TaskContext) error {
|
||||
// again with none inline.
|
||||
func postReview(ctx context.Context, tc *TaskContext, owner, repo string, number int, headSHA string, findings []prreview.ScoredFinding) error {
|
||||
review := forgeReview(findings, tc.prReview.files)
|
||||
err := tc.Forge.CreateReviewComments(ctx, owner, repo, number, headSHA, review)
|
||||
if err == nil || len(review.Comments) == 0 {
|
||||
return err
|
||||
}
|
||||
places := make([]string, 0, len(review.Comments))
|
||||
for _, c := range review.Comments {
|
||||
places = append(places, fmt.Sprintf("%s:%d", c.Path, c.Line))
|
||||
}
|
||||
tc.Log.Info("posting review", "inline", places, "body_bytes", len(review.Body), "diff_files", len(tc.prReview.files))
|
||||
err := tc.Forge.CreateReviewComments(ctx, owner, repo, number, headSHA, review)
|
||||
if err == nil || len(review.Comments) == 0 {
|
||||
return err
|
||||
}
|
||||
tc.Log.Warn("forge refused inline review comments; posting them in the body", "err", err, "inline", places)
|
||||
if retry := tc.Forge.CreateReviewComments(ctx, owner, repo, number, headSHA, forgeReview(findings, nil)); retry != nil {
|
||||
return fmt.Errorf("%w (inline at %s); without inline comments: %w", err, strings.Join(places, ", "), retry)
|
||||
|
||||
Reference in new issue
Block a user