File tree Expand file tree Collapse file tree 1 file changed +26
-7
lines changed
Expand file tree Collapse file tree 1 file changed +26
-7
lines changed Original file line number Diff line number Diff line change @@ -24,13 +24,32 @@ function matchesPattern(domain, filePaths) {
2424
2525// Return the list of files modified in the pull request
2626async function prFiles ( github , context ) {
27- const response = await github . rest . pulls . listFiles ( {
28- owner : context . repo . owner ,
29- repo : context . repo . repo ,
30- pull_number : context . payload . pull_request . number ,
31- } ) ;
32- const prFiles = response . data . map ( ( file ) => file . filename ) ;
33- return prFiles ;
27+ let allFiles = [ ] ;
28+ let page = 0 ;
29+ let filesPerPage = 100 ; // GitHub's maximum per page
30+
31+ while ( true ) {
32+ page ++ ;
33+ const response = await github . rest . pulls . listFiles ( {
34+ owner : context . repo . owner ,
35+ repo : context . repo . repo ,
36+ pull_number : context . payload . pull_request . number ,
37+ per_page : filesPerPage ,
38+ page : page ,
39+ } ) ;
40+
41+ if ( response . data . length === 0 ) {
42+ break ; // Exit the loop if no more files are returned
43+ }
44+
45+ allFiles = allFiles . concat ( response . data . map ( ( file ) => file . filename ) ) ;
46+
47+ if ( response . data . length < filesPerPage ) {
48+ break ; // Exit the loop if last page
49+ }
50+ }
51+
52+ return allFiles ;
3453}
3554
3655// Called by pr.yml. See:
You can’t perform that action at this time.
0 commit comments