hive-forge: point to per-line review comments instead of inlining them, fix pr reviews line numbers

This commit is contained in:
damocles 2026-08-15 12:33:46 +02:00
commit b7a7628845
2 changed files with 35 additions and 15 deletions

View file

@ -124,7 +124,7 @@ fn list_reviews_json(client: &Client, number: u64, reviews: &[Value]) -> Result<
json!({
"id": c.get("id"),
"path": c.get("path"),
"line": c.get("line"),
"line": c.get("position"),
"body": c.get("body"),
})
})
@ -187,8 +187,11 @@ fn list_reviews_text(client: &Client, number: u64, reviews: &[Value]) {
for c in &fetch_inline_comments(client, number, id) {
let path = c.get("path").and_then(Value::as_str).unwrap_or("?");
let cbody = c.get("body").and_then(Value::as_str).unwrap_or("").trim();
// PR-level comments have no line; omit `:line` when absent.
match c.get("line").and_then(Value::as_u64) {
// PR-level comments have no position; omit `:line` when
// absent (also true for a comment whose anchored line has
// since fallen out of the diff — forgejo drops `position`
// in that case too, same display fallback).
match c.get("position").and_then(Value::as_u64) {
Some(line) => println!(" [{path}:{line}] {cbody}"),
None => println!(" [{path}] {cbody}"),
}