@@ -11,7 +11,7 @@ use trainee_tracker::{
1111 config:: { CourseSchedule , CourseScheduleWithRegisterSheetId } ,
1212 course:: { get_descriptor_id_for_pr, match_prs_to_assignments} ,
1313 newtypes:: Region ,
14- octocrab:: octocrab_for_token,
14+ octocrab:: { all_pages , octocrab_for_token} ,
1515 prs:: get_prs,
1616} ;
1717
@@ -298,19 +298,16 @@ async fn check_pr_file_changes(
298298 let directory_matcher = Regex :: new ( directory_description_regex)
299299 . context ( "Invalid regex for task directory match" ) ?;
300300 // Get all of the changed files
301- let pr_files_pages = octocrab
302- . pulls ( org_name, module_name)
303- . list_files ( pr_number)
304- . await
305- . context ( "Failed to get changed files" ) ?;
306- if pr_files_pages. items . is_empty ( ) {
301+ let pr_files = all_pages ( "changed files in pull request" , octocrab, async || {
302+ octocrab
303+ . pulls ( org_name, module_name)
304+ . list_files ( pr_number)
305+ . await
306+ } )
307+ . await ?;
308+ if pr_files. is_empty ( ) {
307309 return Ok ( Some ( ValidationResult :: NoFiles ) ) ; // no files committed
308310 }
309- let pr_files_all = octocrab
310- . all_pages ( pr_files_pages)
311- . await
312- . context ( "Failed to list all changed files" ) ?;
313- let pr_files = pr_files_all. into_iter ( ) ;
314311 // check each file and error if one is in unexpected place
315312 for pr_file in pr_files {
316313 if !directory_matcher. is_match ( & pr_file. filename ) {
0 commit comments