File tree Expand file tree Collapse file tree 1 file changed +9
-25
lines changed
.github/actions/clippy-annotation-reporter/src Expand file tree Collapse file tree 1 file changed +9
-25
lines changed Original file line number Diff line number Diff line change @@ -59,39 +59,23 @@ async fn find_existing_comment(
59
59
signature : & str ,
60
60
) -> Result < Option < u64 > > {
61
61
// Get all comments on the PR
62
- let mut page = octocrab
62
+ let page = octocrab
63
63
. issues ( owner, repo)
64
64
. list_comments ( pr_number)
65
65
. per_page ( 100 )
66
66
. send ( )
67
67
. await
68
68
. context ( "Failed to list PR comments" ) ?;
69
69
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" ) ?;
81
71
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 ) ) ;
95
79
}
96
80
}
97
81
You can’t perform that action at this time.
0 commit comments