Skip to content

Commit 01a53cf

Browse files
authored
chore: make sure getCommits script pulls all commits, not just the last 30 (adobe#9812)
1 parent 7430eee commit 01a53cf

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

scripts/getCommitsForTesting.mjs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,23 @@ async function listCommits() {
144144
let startDate = new Date(start).toISOString();
145145
let endDate = new Date(end).toISOString();
146146

147-
let res = await octokit.request(`GET /repos/adobe/react-spectrum/commits?sha=main&since=${startDate}&until=${endDate}`, {
148-
owner: 'adobe',
149-
repo: 'react-spectrum',
150-
headers: {
151-
'X-GitHub-Api-Version': '2022-11-28'
152-
}
153-
});
147+
let allCommits = [];
148+
let page = 1;
149+
let lastPageSize;
150+
do {
151+
let res = await octokit.request(`GET /repos/adobe/react-spectrum/commits?sha=main&since=${startDate}&until=${endDate}&per_page=100&page=${page}`, {
152+
owner: 'adobe',
153+
repo: 'react-spectrum',
154+
headers: {
155+
'X-GitHub-Api-Version': '2022-11-28'
156+
}
157+
});
158+
allCommits.push(...res.data);
159+
lastPageSize = res.data.length;
160+
page++;
161+
} while (lastPageSize === 100);
154162

155-
return res.data;
163+
return allCommits;
156164
}
157165

158166
async function getPR(num) {

0 commit comments

Comments
 (0)