fix(api): allow pending-inline-comment-only reviews (#39433)

Prior to this change, the API rejected reviews without a summary
comment, even if it had pending inline comments. This differs from the
web UI, which accepts such reviews. The affected endpoints are:

1. Submitting via POST /repos/{owner}/{repo}/pulls/{index}/reviews/{id}.
2. Creating via POST /repos/{owner}/{repo}/pulls/{index}/reviews, both
when finishing an existing pending review and when creating a new
pending review.

The endpoints ran their own emptiness check, which ignored comments
already in a pending review. The fix drops it for comment and pending
reviews and relies on the model's check, which counts them, as the web
UI does.

A review with neither a body nor inline comments remains invalid.

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: bircni <bircni@icloud.com>
This commit is contained in:
Sergio Benitez
2026-09-26 16:51:55 +00:00
committed by GitHub
co-authored by silverwind bircni
parent 3fac5059de
commit dcef88a233
3 changed files with 35 additions and 30 deletions
+1 -1
View File
@@ -456,7 +456,7 @@ func ReviewExists(ctx context.Context, issue *Issue, treePath string, line int64
type ContentEmptyErr struct{}
func (ContentEmptyErr) Error() string {
return "Review content is empty"
return "review requires a body or a comment"
}
// IsContentEmptyErr returns true if err is a ContentEmptyErr