Skip to content

Commit aef96cc

Browse files
Fixing logic to pull all files in a PR so release notes can generate properly. (#20982)
Bypassing the required check as there is no task change and the required checks are not impacted.
1 parent f953dbc commit aef96cc

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

ci/ci-release-notes/release-notes.js

+24-6
Original file line numberDiff line numberDiff line change
@@ -133,18 +133,35 @@ async function fetchPRsForRelease(baseBranch, version) {
133133
* @param {Array<Object>} PRs - PRs to get the changed files for
134134
* @returns {Array<Object>} - Modified files for the PRs which contains tasks options.
135135
*/
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+
136158
async function getPRsFiles(PRs) {
137159
for (let i = 0; i < PRs.length; i++) {
138160
const PR = PRs[i];
139161
const pull_number = PR.number;
140162
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-
});
146163

147-
const files = response.data.map(file => file.filename);
164+
const files = await getAllFilesForPR(pull_number);
148165

149166
for (let j = 0; j < files.length; j++) {
150167
const file = files[j];
@@ -207,6 +224,7 @@ async function main() {
207224
console.log(`Found ${data.length} PRs`);
208225
const PRs = await getPRsFiles(data);
209226
const releaseNotes = tempGen.generateReleaseNotesForPRs(PRs, version);
227+
console.log('Release Notes:\n', releaseNotes); // Output release notes to console
210228
await createRelease(releaseNotes, version, releaseBranch);
211229
} catch (err) {
212230
throw err;

0 commit comments

Comments
 (0)