hive-forge: paginate no-reviewer comment fetch (argus nit on #507)

This commit is contained in:
damocles 2026-05-27 10:29:42 +02:00 committed by Mara
commit 8f4cb3ed29

View file

@ -173,14 +173,16 @@ fn run_no_reviewer(client: &Client, args: NoReviewerArgs) -> Result<()> {
if body.contains(&needle) {
continue;
}
let comments =
client.get_json(&format!("/repos/{repo}/issues/{number}/comments?limit=50"))?;
let mentioned = comments.as_array().is_some_and(|a| {
a.iter().any(|c| {
c.get("body")
.and_then(Value::as_str)
.is_some_and(|body| body.contains(&needle))
})
// Paginate so PRs with >50 comments don't yield false positives
// (argus nit on #507). Same 1000-comment ceiling as elsewhere.
let comments = client.get_json_all(
&format!("/repos/{repo}/issues/{number}/comments?limit={PAGE_LIMIT}"),
MAX_PAGES,
)?;
let mentioned = comments.iter().any(|c| {
c.get("body")
.and_then(Value::as_str)
.is_some_and(|body| body.contains(&needle))
});
if !mentioned {
missing.push(trim_item(pr));