diff --git a/.github/actions/javascript/authorChecklist/index.js b/.github/actions/javascript/authorChecklist/index.js index 370fc40e979d..cb19fedcd1ea 100644 --- a/.github/actions/javascript/authorChecklist/index.js +++ b/.github/actions/javascript/authorChecklist/index.js @@ -16038,13 +16038,28 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const comparison = await this.paginate(this.octokit.repos.compareCommitsWithBasehead, { - owner: CONST_1.default.GITHUB_OWNER, - repo: CONST_1.default.APP_REPO, - basehead: `${fromTag}...${toTag}`, - }); + // Max number of pages to fetch, for safety + const maxPages = 25; + const allCommits = []; + let page = 1; + let totalCommits = 0; + do { + console.log('Getting page of commits: ', page); + const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + basehead: `${fromTag}...${toTag}`, + page: page++, + }); + allCommits.push(...comparison.commits); + totalCommits = comparison.total_commits; + } while (allCommits.length < totalCommits && page < maxPages); + if (page >= maxPages && allCommits.length < totalCommits) { + console.error(`⚠️ Reached the maximum number of pages (${maxPages}) while fetching commits. Some commits may be missing. Total commits fetched: ${allCommits.length} vs expected: ${totalCommits}`); + } + console.log(`Found ${allCommits.length} commits in total`); // Map API response to our CommitType format - return comparison.commits.map((commit) => ({ + return allCommits.map((commit) => ({ commit: commit.sha, subject: commit.commit.message, // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing diff --git a/.github/actions/javascript/awaitStagingDeploys/index.js b/.github/actions/javascript/awaitStagingDeploys/index.js index 591689c38507..fc9eed3e6d79 100644 --- a/.github/actions/javascript/awaitStagingDeploys/index.js +++ b/.github/actions/javascript/awaitStagingDeploys/index.js @@ -12831,13 +12831,28 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const comparison = await this.paginate(this.octokit.repos.compareCommitsWithBasehead, { - owner: CONST_1.default.GITHUB_OWNER, - repo: CONST_1.default.APP_REPO, - basehead: `${fromTag}...${toTag}`, - }); + // Max number of pages to fetch, for safety + const maxPages = 25; + const allCommits = []; + let page = 1; + let totalCommits = 0; + do { + console.log('Getting page of commits: ', page); + const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + basehead: `${fromTag}...${toTag}`, + page: page++, + }); + allCommits.push(...comparison.commits); + totalCommits = comparison.total_commits; + } while (allCommits.length < totalCommits && page < maxPages); + if (page >= maxPages && allCommits.length < totalCommits) { + console.error(`⚠️ Reached the maximum number of pages (${maxPages}) while fetching commits. Some commits may be missing. Total commits fetched: ${allCommits.length} vs expected: ${totalCommits}`); + } + console.log(`Found ${allCommits.length} commits in total`); // Map API response to our CommitType format - return comparison.commits.map((commit) => ({ + return allCommits.map((commit) => ({ commit: commit.sha, subject: commit.commit.message, // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing diff --git a/.github/actions/javascript/checkAndroidStatus/index.js b/.github/actions/javascript/checkAndroidStatus/index.js index 3cfd1351c434..ab85d0a42704 100644 --- a/.github/actions/javascript/checkAndroidStatus/index.js +++ b/.github/actions/javascript/checkAndroidStatus/index.js @@ -737526,13 +737526,28 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const comparison = await this.paginate(this.octokit.repos.compareCommitsWithBasehead, { - owner: CONST_1.default.GITHUB_OWNER, - repo: CONST_1.default.APP_REPO, - basehead: `${fromTag}...${toTag}`, - }); + // Max number of pages to fetch, for safety + const maxPages = 25; + const allCommits = []; + let page = 1; + let totalCommits = 0; + do { + console.log('Getting page of commits: ', page); + const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + basehead: `${fromTag}...${toTag}`, + page: page++, + }); + allCommits.push(...comparison.commits); + totalCommits = comparison.total_commits; + } while (allCommits.length < totalCommits && page < maxPages); + if (page >= maxPages && allCommits.length < totalCommits) { + console.error(`⚠️ Reached the maximum number of pages (${maxPages}) while fetching commits. Some commits may be missing. Total commits fetched: ${allCommits.length} vs expected: ${totalCommits}`); + } + console.log(`Found ${allCommits.length} commits in total`); // Map API response to our CommitType format - return comparison.commits.map((commit) => ({ + return allCommits.map((commit) => ({ commit: commit.sha, subject: commit.commit.message, // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing diff --git a/.github/actions/javascript/checkDeployBlockers/index.js b/.github/actions/javascript/checkDeployBlockers/index.js index b7de21e5da26..223ce5514eb9 100644 --- a/.github/actions/javascript/checkDeployBlockers/index.js +++ b/.github/actions/javascript/checkDeployBlockers/index.js @@ -12114,13 +12114,28 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const comparison = await this.paginate(this.octokit.repos.compareCommitsWithBasehead, { - owner: CONST_1.default.GITHUB_OWNER, - repo: CONST_1.default.APP_REPO, - basehead: `${fromTag}...${toTag}`, - }); + // Max number of pages to fetch, for safety + const maxPages = 25; + const allCommits = []; + let page = 1; + let totalCommits = 0; + do { + console.log('Getting page of commits: ', page); + const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + basehead: `${fromTag}...${toTag}`, + page: page++, + }); + allCommits.push(...comparison.commits); + totalCommits = comparison.total_commits; + } while (allCommits.length < totalCommits && page < maxPages); + if (page >= maxPages && allCommits.length < totalCommits) { + console.error(`⚠️ Reached the maximum number of pages (${maxPages}) while fetching commits. Some commits may be missing. Total commits fetched: ${allCommits.length} vs expected: ${totalCommits}`); + } + console.log(`Found ${allCommits.length} commits in total`); // Map API response to our CommitType format - return comparison.commits.map((commit) => ({ + return allCommits.map((commit) => ({ commit: commit.sha, subject: commit.commit.message, // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing diff --git a/.github/actions/javascript/createOrUpdateStagingDeploy/index.js b/.github/actions/javascript/createOrUpdateStagingDeploy/index.js index fb6095e0f59d..fda068ae78c0 100644 --- a/.github/actions/javascript/createOrUpdateStagingDeploy/index.js +++ b/.github/actions/javascript/createOrUpdateStagingDeploy/index.js @@ -12351,13 +12351,28 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const comparison = await this.paginate(this.octokit.repos.compareCommitsWithBasehead, { - owner: CONST_1.default.GITHUB_OWNER, - repo: CONST_1.default.APP_REPO, - basehead: `${fromTag}...${toTag}`, - }); + // Max number of pages to fetch, for safety + const maxPages = 25; + const allCommits = []; + let page = 1; + let totalCommits = 0; + do { + console.log('Getting page of commits: ', page); + const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + basehead: `${fromTag}...${toTag}`, + page: page++, + }); + allCommits.push(...comparison.commits); + totalCommits = comparison.total_commits; + } while (allCommits.length < totalCommits && page < maxPages); + if (page >= maxPages && allCommits.length < totalCommits) { + console.error(`⚠️ Reached the maximum number of pages (${maxPages}) while fetching commits. Some commits may be missing. Total commits fetched: ${allCommits.length} vs expected: ${totalCommits}`); + } + console.log(`Found ${allCommits.length} commits in total`); // Map API response to our CommitType format - return comparison.commits.map((commit) => ({ + return allCommits.map((commit) => ({ commit: commit.sha, subject: commit.commit.message, // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing diff --git a/.github/actions/javascript/getArtifactInfo/index.js b/.github/actions/javascript/getArtifactInfo/index.js index 64457c569d72..fcd65ddc583e 100644 --- a/.github/actions/javascript/getArtifactInfo/index.js +++ b/.github/actions/javascript/getArtifactInfo/index.js @@ -12075,13 +12075,28 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const comparison = await this.paginate(this.octokit.repos.compareCommitsWithBasehead, { - owner: CONST_1.default.GITHUB_OWNER, - repo: CONST_1.default.APP_REPO, - basehead: `${fromTag}...${toTag}`, - }); + // Max number of pages to fetch, for safety + const maxPages = 25; + const allCommits = []; + let page = 1; + let totalCommits = 0; + do { + console.log('Getting page of commits: ', page); + const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + basehead: `${fromTag}...${toTag}`, + page: page++, + }); + allCommits.push(...comparison.commits); + totalCommits = comparison.total_commits; + } while (allCommits.length < totalCommits && page < maxPages); + if (page >= maxPages && allCommits.length < totalCommits) { + console.error(`⚠️ Reached the maximum number of pages (${maxPages}) while fetching commits. Some commits may be missing. Total commits fetched: ${allCommits.length} vs expected: ${totalCommits}`); + } + console.log(`Found ${allCommits.length} commits in total`); // Map API response to our CommitType format - return comparison.commits.map((commit) => ({ + return allCommits.map((commit) => ({ commit: commit.sha, subject: commit.commit.message, // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing diff --git a/.github/actions/javascript/getDeployPullRequestList/index.js b/.github/actions/javascript/getDeployPullRequestList/index.js index 341f2c12b2ac..e03a56549976 100644 --- a/.github/actions/javascript/getDeployPullRequestList/index.js +++ b/.github/actions/javascript/getDeployPullRequestList/index.js @@ -12364,13 +12364,28 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const comparison = await this.paginate(this.octokit.repos.compareCommitsWithBasehead, { - owner: CONST_1.default.GITHUB_OWNER, - repo: CONST_1.default.APP_REPO, - basehead: `${fromTag}...${toTag}`, - }); + // Max number of pages to fetch, for safety + const maxPages = 25; + const allCommits = []; + let page = 1; + let totalCommits = 0; + do { + console.log('Getting page of commits: ', page); + const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + basehead: `${fromTag}...${toTag}`, + page: page++, + }); + allCommits.push(...comparison.commits); + totalCommits = comparison.total_commits; + } while (allCommits.length < totalCommits && page < maxPages); + if (page >= maxPages && allCommits.length < totalCommits) { + console.error(`⚠️ Reached the maximum number of pages (${maxPages}) while fetching commits. Some commits may be missing. Total commits fetched: ${allCommits.length} vs expected: ${totalCommits}`); + } + console.log(`Found ${allCommits.length} commits in total`); // Map API response to our CommitType format - return comparison.commits.map((commit) => ({ + return allCommits.map((commit) => ({ commit: commit.sha, subject: commit.commit.message, // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing diff --git a/.github/actions/javascript/getPreviousVersion/index.js b/.github/actions/javascript/getPreviousVersion/index.js index ba4d271352d1..27118c27e614 100644 --- a/.github/actions/javascript/getPreviousVersion/index.js +++ b/.github/actions/javascript/getPreviousVersion/index.js @@ -12219,13 +12219,28 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const comparison = await this.paginate(this.octokit.repos.compareCommitsWithBasehead, { - owner: CONST_1.default.GITHUB_OWNER, - repo: CONST_1.default.APP_REPO, - basehead: `${fromTag}...${toTag}`, - }); + // Max number of pages to fetch, for safety + const maxPages = 25; + const allCommits = []; + let page = 1; + let totalCommits = 0; + do { + console.log('Getting page of commits: ', page); + const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + basehead: `${fromTag}...${toTag}`, + page: page++, + }); + allCommits.push(...comparison.commits); + totalCommits = comparison.total_commits; + } while (allCommits.length < totalCommits && page < maxPages); + if (page >= maxPages && allCommits.length < totalCommits) { + console.error(`⚠️ Reached the maximum number of pages (${maxPages}) while fetching commits. Some commits may be missing. Total commits fetched: ${allCommits.length} vs expected: ${totalCommits}`); + } + console.log(`Found ${allCommits.length} commits in total`); // Map API response to our CommitType format - return comparison.commits.map((commit) => ({ + return allCommits.map((commit) => ({ commit: commit.sha, subject: commit.commit.message, // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing diff --git a/.github/actions/javascript/getPullRequestDetails/index.js b/.github/actions/javascript/getPullRequestDetails/index.js index ccd3ba24daf5..f7e13f5ec1b2 100644 --- a/.github/actions/javascript/getPullRequestDetails/index.js +++ b/.github/actions/javascript/getPullRequestDetails/index.js @@ -12178,13 +12178,28 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const comparison = await this.paginate(this.octokit.repos.compareCommitsWithBasehead, { - owner: CONST_1.default.GITHUB_OWNER, - repo: CONST_1.default.APP_REPO, - basehead: `${fromTag}...${toTag}`, - }); + // Max number of pages to fetch, for safety + const maxPages = 25; + const allCommits = []; + let page = 1; + let totalCommits = 0; + do { + console.log('Getting page of commits: ', page); + const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + basehead: `${fromTag}...${toTag}`, + page: page++, + }); + allCommits.push(...comparison.commits); + totalCommits = comparison.total_commits; + } while (allCommits.length < totalCommits && page < maxPages); + if (page >= maxPages && allCommits.length < totalCommits) { + console.error(`⚠️ Reached the maximum number of pages (${maxPages}) while fetching commits. Some commits may be missing. Total commits fetched: ${allCommits.length} vs expected: ${totalCommits}`); + } + console.log(`Found ${allCommits.length} commits in total`); // Map API response to our CommitType format - return comparison.commits.map((commit) => ({ + return allCommits.map((commit) => ({ commit: commit.sha, subject: commit.commit.message, // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing diff --git a/.github/actions/javascript/isStagingDeployLocked/index.js b/.github/actions/javascript/isStagingDeployLocked/index.js index fb8015363f77..3376e2081c2c 100644 --- a/.github/actions/javascript/isStagingDeployLocked/index.js +++ b/.github/actions/javascript/isStagingDeployLocked/index.js @@ -12075,13 +12075,28 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const comparison = await this.paginate(this.octokit.repos.compareCommitsWithBasehead, { - owner: CONST_1.default.GITHUB_OWNER, - repo: CONST_1.default.APP_REPO, - basehead: `${fromTag}...${toTag}`, - }); + // Max number of pages to fetch, for safety + const maxPages = 25; + const allCommits = []; + let page = 1; + let totalCommits = 0; + do { + console.log('Getting page of commits: ', page); + const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + basehead: `${fromTag}...${toTag}`, + page: page++, + }); + allCommits.push(...comparison.commits); + totalCommits = comparison.total_commits; + } while (allCommits.length < totalCommits && page < maxPages); + if (page >= maxPages && allCommits.length < totalCommits) { + console.error(`⚠️ Reached the maximum number of pages (${maxPages}) while fetching commits. Some commits may be missing. Total commits fetched: ${allCommits.length} vs expected: ${totalCommits}`); + } + console.log(`Found ${allCommits.length} commits in total`); // Map API response to our CommitType format - return comparison.commits.map((commit) => ({ + return allCommits.map((commit) => ({ commit: commit.sha, subject: commit.commit.message, // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing diff --git a/.github/actions/javascript/markPullRequestsAsDeployed/index.js b/.github/actions/javascript/markPullRequestsAsDeployed/index.js index c1a2046bf28d..ce81185aaf11 100644 --- a/.github/actions/javascript/markPullRequestsAsDeployed/index.js +++ b/.github/actions/javascript/markPullRequestsAsDeployed/index.js @@ -13472,13 +13472,28 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const comparison = await this.paginate(this.octokit.repos.compareCommitsWithBasehead, { - owner: CONST_1.default.GITHUB_OWNER, - repo: CONST_1.default.APP_REPO, - basehead: `${fromTag}...${toTag}`, - }); + // Max number of pages to fetch, for safety + const maxPages = 25; + const allCommits = []; + let page = 1; + let totalCommits = 0; + do { + console.log('Getting page of commits: ', page); + const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + basehead: `${fromTag}...${toTag}`, + page: page++, + }); + allCommits.push(...comparison.commits); + totalCommits = comparison.total_commits; + } while (allCommits.length < totalCommits && page < maxPages); + if (page >= maxPages && allCommits.length < totalCommits) { + console.error(`⚠️ Reached the maximum number of pages (${maxPages}) while fetching commits. Some commits may be missing. Total commits fetched: ${allCommits.length} vs expected: ${totalCommits}`); + } + console.log(`Found ${allCommits.length} commits in total`); // Map API response to our CommitType format - return comparison.commits.map((commit) => ({ + return allCommits.map((commit) => ({ commit: commit.sha, subject: commit.commit.message, // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing diff --git a/.github/actions/javascript/postTestBuildComment/index.js b/.github/actions/javascript/postTestBuildComment/index.js index beb5afe959dc..462f58001b21 100644 --- a/.github/actions/javascript/postTestBuildComment/index.js +++ b/.github/actions/javascript/postTestBuildComment/index.js @@ -12187,13 +12187,28 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const comparison = await this.paginate(this.octokit.repos.compareCommitsWithBasehead, { - owner: CONST_1.default.GITHUB_OWNER, - repo: CONST_1.default.APP_REPO, - basehead: `${fromTag}...${toTag}`, - }); + // Max number of pages to fetch, for safety + const maxPages = 25; + const allCommits = []; + let page = 1; + let totalCommits = 0; + do { + console.log('Getting page of commits: ', page); + const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + basehead: `${fromTag}...${toTag}`, + page: page++, + }); + allCommits.push(...comparison.commits); + totalCommits = comparison.total_commits; + } while (allCommits.length < totalCommits && page < maxPages); + if (page >= maxPages && allCommits.length < totalCommits) { + console.error(`⚠️ Reached the maximum number of pages (${maxPages}) while fetching commits. Some commits may be missing. Total commits fetched: ${allCommits.length} vs expected: ${totalCommits}`); + } + console.log(`Found ${allCommits.length} commits in total`); // Map API response to our CommitType format - return comparison.commits.map((commit) => ({ + return allCommits.map((commit) => ({ commit: commit.sha, subject: commit.commit.message, // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing diff --git a/.github/actions/javascript/proposalPoliceComment/index.js b/.github/actions/javascript/proposalPoliceComment/index.js index 201ee0fb9677..596dac58d586 100644 --- a/.github/actions/javascript/proposalPoliceComment/index.js +++ b/.github/actions/javascript/proposalPoliceComment/index.js @@ -18658,13 +18658,28 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const comparison = await this.paginate(this.octokit.repos.compareCommitsWithBasehead, { - owner: CONST_1.default.GITHUB_OWNER, - repo: CONST_1.default.APP_REPO, - basehead: `${fromTag}...${toTag}`, - }); + // Max number of pages to fetch, for safety + const maxPages = 25; + const allCommits = []; + let page = 1; + let totalCommits = 0; + do { + console.log('Getting page of commits: ', page); + const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + basehead: `${fromTag}...${toTag}`, + page: page++, + }); + allCommits.push(...comparison.commits); + totalCommits = comparison.total_commits; + } while (allCommits.length < totalCommits && page < maxPages); + if (page >= maxPages && allCommits.length < totalCommits) { + console.error(`⚠️ Reached the maximum number of pages (${maxPages}) while fetching commits. Some commits may be missing. Total commits fetched: ${allCommits.length} vs expected: ${totalCommits}`); + } + console.log(`Found ${allCommits.length} commits in total`); // Map API response to our CommitType format - return comparison.commits.map((commit) => ({ + return allCommits.map((commit) => ({ commit: commit.sha, subject: commit.commit.message, // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing diff --git a/.github/actions/javascript/reopenIssueWithComment/index.js b/.github/actions/javascript/reopenIssueWithComment/index.js index 87b31b666deb..6f8a60daec6e 100644 --- a/.github/actions/javascript/reopenIssueWithComment/index.js +++ b/.github/actions/javascript/reopenIssueWithComment/index.js @@ -12085,13 +12085,28 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const comparison = await this.paginate(this.octokit.repos.compareCommitsWithBasehead, { - owner: CONST_1.default.GITHUB_OWNER, - repo: CONST_1.default.APP_REPO, - basehead: `${fromTag}...${toTag}`, - }); + // Max number of pages to fetch, for safety + const maxPages = 25; + const allCommits = []; + let page = 1; + let totalCommits = 0; + do { + console.log('Getting page of commits: ', page); + const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + basehead: `${fromTag}...${toTag}`, + page: page++, + }); + allCommits.push(...comparison.commits); + totalCommits = comparison.total_commits; + } while (allCommits.length < totalCommits && page < maxPages); + if (page >= maxPages && allCommits.length < totalCommits) { + console.error(`⚠️ Reached the maximum number of pages (${maxPages}) while fetching commits. Some commits may be missing. Total commits fetched: ${allCommits.length} vs expected: ${totalCommits}`); + } + console.log(`Found ${allCommits.length} commits in total`); // Map API response to our CommitType format - return comparison.commits.map((commit) => ({ + return allCommits.map((commit) => ({ commit: commit.sha, subject: commit.commit.message, // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing diff --git a/.github/actions/javascript/reviewerChecklist/index.js b/.github/actions/javascript/reviewerChecklist/index.js index 26b171057464..d24eb894ab9a 100644 --- a/.github/actions/javascript/reviewerChecklist/index.js +++ b/.github/actions/javascript/reviewerChecklist/index.js @@ -12177,13 +12177,28 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const comparison = await this.paginate(this.octokit.repos.compareCommitsWithBasehead, { - owner: CONST_1.default.GITHUB_OWNER, - repo: CONST_1.default.APP_REPO, - basehead: `${fromTag}...${toTag}`, - }); + // Max number of pages to fetch, for safety + const maxPages = 25; + const allCommits = []; + let page = 1; + let totalCommits = 0; + do { + console.log('Getting page of commits: ', page); + const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + basehead: `${fromTag}...${toTag}`, + page: page++, + }); + allCommits.push(...comparison.commits); + totalCommits = comparison.total_commits; + } while (allCommits.length < totalCommits && page < maxPages); + if (page >= maxPages && allCommits.length < totalCommits) { + console.error(`⚠️ Reached the maximum number of pages (${maxPages}) while fetching commits. Some commits may be missing. Total commits fetched: ${allCommits.length} vs expected: ${totalCommits}`); + } + console.log(`Found ${allCommits.length} commits in total`); // Map API response to our CommitType format - return comparison.commits.map((commit) => ({ + return allCommits.map((commit) => ({ commit: commit.sha, subject: commit.commit.message, // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing diff --git a/.github/actions/javascript/verifySignedCommits/index.js b/.github/actions/javascript/verifySignedCommits/index.js index 652bff7bbba8..214e890ab509 100644 --- a/.github/actions/javascript/verifySignedCommits/index.js +++ b/.github/actions/javascript/verifySignedCommits/index.js @@ -12117,13 +12117,28 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const comparison = await this.paginate(this.octokit.repos.compareCommitsWithBasehead, { - owner: CONST_1.default.GITHUB_OWNER, - repo: CONST_1.default.APP_REPO, - basehead: `${fromTag}...${toTag}`, - }); + // Max number of pages to fetch, for safety + const maxPages = 25; + const allCommits = []; + let page = 1; + let totalCommits = 0; + do { + console.log('Getting page of commits: ', page); + const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + basehead: `${fromTag}...${toTag}`, + page: page++, + }); + allCommits.push(...comparison.commits); + totalCommits = comparison.total_commits; + } while (allCommits.length < totalCommits && page < maxPages); + if (page >= maxPages && allCommits.length < totalCommits) { + console.error(`⚠️ Reached the maximum number of pages (${maxPages}) while fetching commits. Some commits may be missing. Total commits fetched: ${allCommits.length} vs expected: ${totalCommits}`); + } + console.log(`Found ${allCommits.length} commits in total`); // Map API response to our CommitType format - return comparison.commits.map((commit) => ({ + return allCommits.map((commit) => ({ commit: commit.sha, subject: commit.commit.message, // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing diff --git a/.github/libs/GithubUtils.ts b/.github/libs/GithubUtils.ts index 7d2bf1f20a56..eec7144dc81f 100644 --- a/.github/libs/GithubUtils.ts +++ b/.github/libs/GithubUtils.ts @@ -22,6 +22,7 @@ type ListForRepoResult = RestEndpointMethodTypes['issues']['listForRepo']['respo type OctokitIssueItem = OctokitComponents['schemas']['issue']; type ListForRepoMethod = RestEndpointMethods['issues']['listForRepo']; +type Commit = OctokitComponents['schemas']['commit']; type CommitType = { commit: string; @@ -577,14 +578,33 @@ class GithubUtils { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const comparison = await this.paginate(this.octokit.repos.compareCommitsWithBasehead, { - owner: CONST.GITHUB_OWNER, - repo: CONST.APP_REPO, - basehead: `${fromTag}...${toTag}`, - }); + // Max number of pages to fetch, for safety + const maxPages = 25; + const allCommits: Commit[] = []; + let page = 1; + let totalCommits = 0; + + do { + console.log('Getting page of commits: ', page); + + const {data: comparison} = await this.octokit.repos.compareCommitsWithBasehead({ + owner: CONST.GITHUB_OWNER, + repo: CONST.APP_REPO, + basehead: `${fromTag}...${toTag}`, + page: page++, + }); + + allCommits.push(...comparison.commits); + totalCommits = comparison.total_commits; + } while (allCommits.length < totalCommits && page < maxPages); + + if (page >= maxPages && allCommits.length < totalCommits) { + console.error(`⚠️ Reached the maximum number of pages (${maxPages}) while fetching commits. Some commits may be missing. Total commits fetched: ${allCommits.length} vs expected: ${totalCommits}`); + } + console.log(`Found ${allCommits.length} commits in total`); // Map API response to our CommitType format - return comparison.commits.map((commit) => ({ + return allCommits.map((commit) => ({ commit: commit.sha, subject: commit.commit.message, // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing