@@ -133,18 +133,35 @@ async function fetchPRsForRelease(baseBranch, version) {
133
133
* @param {Array<Object> } PRs - PRs to get the changed files for
134
134
* @returns {Array<Object> } - Modified files for the PRs which contains tasks options.
135
135
*/
136
+ async function getAllFilesForPR ( pull_number ) {
137
+ const files = [ ] ;
138
+ let page = 1 ;
139
+
140
+ while ( true ) {
141
+ const response = await octokit . pulls . listFiles ( {
142
+ owner : OWNER ,
143
+ repo : REPO ,
144
+ pull_number,
145
+ per_page : 100 ,
146
+ page
147
+ } ) ;
148
+
149
+ files . push ( ...response . data . map ( file => file . filename ) ) ;
150
+
151
+ if ( response . data . length < 100 ) break ; // Exit loop if fewer than 100 files are returned
152
+ page ++ ;
153
+ }
154
+ console . log ( `Files for PR ${ pull_number } :` , files ) ;
155
+ return files ;
156
+ }
157
+
136
158
async function getPRsFiles ( PRs ) {
137
159
for ( let i = 0 ; i < PRs . length ; i ++ ) {
138
160
const PR = PRs [ i ] ;
139
161
const pull_number = PR . number ;
140
162
console . log ( `Fetching files for PR ${ pull_number } ` ) ;
141
- const response = await octokit . pulls . listFiles ( {
142
- owner : OWNER ,
143
- repo : REPO ,
144
- pull_number
145
- } ) ;
146
163
147
- const files = response . data . map ( file => file . filename ) ;
164
+ const files = await getAllFilesForPR ( pull_number ) ;
148
165
149
166
for ( let j = 0 ; j < files . length ; j ++ ) {
150
167
const file = files [ j ] ;
@@ -207,6 +224,7 @@ async function main() {
207
224
console . log ( `Found ${ data . length } PRs` ) ;
208
225
const PRs = await getPRsFiles ( data ) ;
209
226
const releaseNotes = tempGen . generateReleaseNotesForPRs ( PRs , version ) ;
227
+ console . log ( 'Release Notes:\n' , releaseNotes ) ; // Output release notes to console
210
228
await createRelease ( releaseNotes , version , releaseBranch ) ;
211
229
} catch ( err ) {
212
230
throw err ;
0 commit comments