fix(review-pr): anchor findings to diff lines

The gitea posting snippet used the issue-comment endpoint, which has no
path or line, so findings named `path:line` in prose instead of landing
on the code. Both forges now post one COMMENT review carrying anchored
findings in comments[] and loose ones in the body.

land's gitea baseline missed review-comment ids, which would replay
every code comment on the first hint.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Miguel Palhas
2026-08-20 10:24:00 +01:00
parent 465b20a7c6
commit 5d1a81ec48
2 changed files with 51 additions and 18 deletions
+11 -3
View File
@@ -61,9 +61,11 @@ fi
Gitea equivalent — issue comments plus reviews:
```bash
{ curl -sS -H "Authorization: token $GITEA_TOKEN" "$BASE/api/v1/repos/$REPO/issues/$N/comments"; \
curl -sS -H "Authorization: token $GITEA_TOKEN" "$BASE/api/v1/repos/$REPO/pulls/$N/reviews"; } 2>/dev/null \
| jq -r '.[]?.id' > "$seen" || : > "$seen"
{ curl -sS -H "Authorization: token $GITEA_TOKEN" "$BASE/api/v1/repos/$REPO/issues/$N/comments" | jq -r '.[]?.id'
for r in $(curl -sS -H "Authorization: token $GITEA_TOKEN" "$BASE/api/v1/repos/$REPO/pulls/$N/reviews" | jq -r '.[]?.id'); do
echo "$r"
curl -sS -H "Authorization: token $GITEA_TOKEN" "$BASE/api/v1/repos/$REPO/pulls/$N/reviews/$r/comments" | jq -r '.[]?.id'
done; } 2>/dev/null > "$seen" || : > "$seen"
```
**Request the Copilot review** (github only, once). Its comments then
@@ -111,6 +113,12 @@ and act on what's left:
echo "$rid" >> "$seen"
```
Gitea has no reply endpoint, so that lands as a loose PR comment. To
answer a code comment inside its own thread, post a review instead
whose `comments[]` entry repeats the same `path` and `new_position` —
gitea groups code comments by position into one conversation. Record
the review id and its comment ids.
- **Resolve the thread** (github only — gitea has no per-thread
resolve, so a short confirming reply plus the pushed fix is the
signal):