Skip to content

Commit cce6240

Browse files
committed
wip commenter
1 parent 1a8788d commit cce6240

File tree

1 file changed

+9
-25
lines changed

1 file changed

+9
-25
lines changed

.github/actions/clippy-annotation-reporter/src/commenter.rs

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -59,39 +59,23 @@ async fn find_existing_comment(
5959
signature: &str,
6060
) -> Result<Option<u64>> {
6161
// Get all comments on the PR
62-
let mut page = octocrab
62+
let page = octocrab
6363
.issues(owner, repo)
6464
.list_comments(pr_number)
6565
.per_page(100)
6666
.send()
6767
.await
6868
.context("Failed to list PR comments")?;
6969

70-
// Process current and subsequent pages
71-
loop {
72-
for comment in &page {
73-
if comment
74-
.body
75-
.as_ref()
76-
.is_some_and(|body| body.contains(signature))
77-
{
78-
return Ok(Some(*comment.id));
79-
}
80-
}
70+
let all_pages = octocrab.all_pages(page).await.context("Failed to fetch all pages of comments")?;
8171

82-
// Try to get the next page if it exists
83-
match octocrab.get_page(&page.next).await {
84-
Ok(Some(next_page)) => {
85-
page = next_page;
86-
}
87-
Ok(None) => {
88-
// No more pages
89-
break;
90-
}
91-
Err(e) => {
92-
error!("Warning: Failed to fetch next page of comments: {}", e);
93-
break;
94-
}
72+
for comment in all_pages {
73+
if comment
74+
.body
75+
.as_ref()
76+
.is_some_and(|body| body.contains(signature))
77+
{
78+
return Ok(Some(*comment.id));
9579
}
9680
}
9781

0 commit comments

Comments
 (0)