From 4fc42343fb4bdd296d5295e7dd21f1c8012eb178 Mon Sep 17 00:00:00 2001 From: rory Date: Wed, 14 May 2025 16:04:41 -0700 Subject: [PATCH 1/5] Use compareCommitsWithBasehead --- .github/actions/javascript/authorChecklist/index.js | 7 +++---- .github/actions/javascript/awaitStagingDeploys/index.js | 7 +++---- .github/actions/javascript/checkAndroidStatus/index.js | 7 +++---- .github/actions/javascript/checkDeployBlockers/index.js | 7 +++---- .../javascript/createOrUpdateStagingDeploy/index.js | 7 +++---- .github/actions/javascript/getArtifactInfo/index.js | 7 +++---- .../actions/javascript/getDeployPullRequestList/index.js | 7 +++---- .github/actions/javascript/getPreviousVersion/index.js | 7 +++---- .github/actions/javascript/getPullRequestDetails/index.js | 7 +++---- .github/actions/javascript/isStagingDeployLocked/index.js | 7 +++---- .../actions/javascript/markPullRequestsAsDeployed/index.js | 7 +++---- .github/actions/javascript/postTestBuildComment/index.js | 7 +++---- .github/actions/javascript/proposalPoliceComment/index.js | 7 +++---- .github/actions/javascript/reopenIssueWithComment/index.js | 7 +++---- .github/actions/javascript/reviewerChecklist/index.js | 7 +++---- .github/actions/javascript/verifySignedCommits/index.js | 7 +++---- .github/libs/GithubUtils.ts | 7 +++---- 17 files changed, 51 insertions(+), 68 deletions(-) diff --git a/.github/actions/javascript/authorChecklist/index.js b/.github/actions/javascript/authorChecklist/index.js index 68d041efa6be..5a475b3b8677 100644 --- a/.github/actions/javascript/authorChecklist/index.js +++ b/.github/actions/javascript/authorChecklist/index.js @@ -16038,11 +16038,10 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const { data: comparison } = await this.octokit.repos.compareCommits({ + const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, - base: fromTag, - head: toTag, + basehead: `${fromTag}...${toTag}`, }); // Map API response to our CommitType format return comparison.commits.map((commit) => ({ @@ -16054,7 +16053,7 @@ class GithubUtils { } catch (error) { if (error instanceof request_error_1.RequestError && error.status === 404) { - console.error(`❓❓ Failed to compare commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them. 💡💡`); + console.error(`❓Failed to compare commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them. 💡`); } // Re-throw the error after logging throw error; diff --git a/.github/actions/javascript/awaitStagingDeploys/index.js b/.github/actions/javascript/awaitStagingDeploys/index.js index 3dadb314fbf1..b58a0bd785dc 100644 --- a/.github/actions/javascript/awaitStagingDeploys/index.js +++ b/.github/actions/javascript/awaitStagingDeploys/index.js @@ -12831,11 +12831,10 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const { data: comparison } = await this.octokit.repos.compareCommits({ + const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, - base: fromTag, - head: toTag, + basehead: `${fromTag}...${toTag}`, }); // Map API response to our CommitType format return comparison.commits.map((commit) => ({ @@ -12847,7 +12846,7 @@ class GithubUtils { } catch (error) { if (error instanceof request_error_1.RequestError && error.status === 404) { - console.error(`❓❓ Failed to compare commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them. 💡💡`); + console.error(`❓Failed to compare commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them. 💡`); } // Re-throw the error after logging throw error; diff --git a/.github/actions/javascript/checkAndroidStatus/index.js b/.github/actions/javascript/checkAndroidStatus/index.js index d02caf551eab..36a392cc5baf 100644 --- a/.github/actions/javascript/checkAndroidStatus/index.js +++ b/.github/actions/javascript/checkAndroidStatus/index.js @@ -737526,11 +737526,10 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const { data: comparison } = await this.octokit.repos.compareCommits({ + const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, - base: fromTag, - head: toTag, + basehead: `${fromTag}...${toTag}`, }); // Map API response to our CommitType format return comparison.commits.map((commit) => ({ @@ -737542,7 +737541,7 @@ class GithubUtils { } catch (error) { if (error instanceof request_error_1.RequestError && error.status === 404) { - console.error(`❓❓ Failed to compare commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them. 💡💡`); + console.error(`❓Failed to compare commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them. 💡`); } // Re-throw the error after logging throw error; diff --git a/.github/actions/javascript/checkDeployBlockers/index.js b/.github/actions/javascript/checkDeployBlockers/index.js index 2e328c94a01d..db1a3810f788 100644 --- a/.github/actions/javascript/checkDeployBlockers/index.js +++ b/.github/actions/javascript/checkDeployBlockers/index.js @@ -12114,11 +12114,10 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const { data: comparison } = await this.octokit.repos.compareCommits({ + const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, - base: fromTag, - head: toTag, + basehead: `${fromTag}...${toTag}`, }); // Map API response to our CommitType format return comparison.commits.map((commit) => ({ @@ -12130,7 +12129,7 @@ class GithubUtils { } catch (error) { if (error instanceof request_error_1.RequestError && error.status === 404) { - console.error(`❓❓ Failed to compare commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them. 💡💡`); + console.error(`❓Failed to compare commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them. 💡`); } // Re-throw the error after logging throw error; diff --git a/.github/actions/javascript/createOrUpdateStagingDeploy/index.js b/.github/actions/javascript/createOrUpdateStagingDeploy/index.js index 443ba3de957f..3a2782e9d65e 100644 --- a/.github/actions/javascript/createOrUpdateStagingDeploy/index.js +++ b/.github/actions/javascript/createOrUpdateStagingDeploy/index.js @@ -12351,11 +12351,10 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const { data: comparison } = await this.octokit.repos.compareCommits({ + const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, - base: fromTag, - head: toTag, + basehead: `${fromTag}...${toTag}`, }); // Map API response to our CommitType format return comparison.commits.map((commit) => ({ @@ -12367,7 +12366,7 @@ class GithubUtils { } catch (error) { if (error instanceof request_error_1.RequestError && error.status === 404) { - console.error(`❓❓ Failed to compare commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them. 💡💡`); + console.error(`❓Failed to compare commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them. 💡`); } // Re-throw the error after logging throw error; diff --git a/.github/actions/javascript/getArtifactInfo/index.js b/.github/actions/javascript/getArtifactInfo/index.js index 35afda619d04..e0b1b010621e 100644 --- a/.github/actions/javascript/getArtifactInfo/index.js +++ b/.github/actions/javascript/getArtifactInfo/index.js @@ -12075,11 +12075,10 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const { data: comparison } = await this.octokit.repos.compareCommits({ + const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, - base: fromTag, - head: toTag, + basehead: `${fromTag}...${toTag}`, }); // Map API response to our CommitType format return comparison.commits.map((commit) => ({ @@ -12091,7 +12090,7 @@ class GithubUtils { } catch (error) { if (error instanceof request_error_1.RequestError && error.status === 404) { - console.error(`❓❓ Failed to compare commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them. 💡💡`); + console.error(`❓Failed to compare commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them. 💡`); } // Re-throw the error after logging throw error; diff --git a/.github/actions/javascript/getDeployPullRequestList/index.js b/.github/actions/javascript/getDeployPullRequestList/index.js index 3eb7d91f847f..d86032bd04e3 100644 --- a/.github/actions/javascript/getDeployPullRequestList/index.js +++ b/.github/actions/javascript/getDeployPullRequestList/index.js @@ -12364,11 +12364,10 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const { data: comparison } = await this.octokit.repos.compareCommits({ + const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, - base: fromTag, - head: toTag, + basehead: `${fromTag}...${toTag}`, }); // Map API response to our CommitType format return comparison.commits.map((commit) => ({ @@ -12380,7 +12379,7 @@ class GithubUtils { } catch (error) { if (error instanceof request_error_1.RequestError && error.status === 404) { - console.error(`❓❓ Failed to compare commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them. 💡💡`); + console.error(`❓Failed to compare commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them. 💡`); } // Re-throw the error after logging throw error; diff --git a/.github/actions/javascript/getPreviousVersion/index.js b/.github/actions/javascript/getPreviousVersion/index.js index 406f98266713..97fa0e2b15ab 100644 --- a/.github/actions/javascript/getPreviousVersion/index.js +++ b/.github/actions/javascript/getPreviousVersion/index.js @@ -12219,11 +12219,10 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const { data: comparison } = await this.octokit.repos.compareCommits({ + const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, - base: fromTag, - head: toTag, + basehead: `${fromTag}...${toTag}`, }); // Map API response to our CommitType format return comparison.commits.map((commit) => ({ @@ -12235,7 +12234,7 @@ class GithubUtils { } catch (error) { if (error instanceof request_error_1.RequestError && error.status === 404) { - console.error(`❓❓ Failed to compare commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them. 💡💡`); + console.error(`❓Failed to compare commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them. 💡`); } // Re-throw the error after logging throw error; diff --git a/.github/actions/javascript/getPullRequestDetails/index.js b/.github/actions/javascript/getPullRequestDetails/index.js index 3cb00f1acb7c..a6eb3d611c17 100644 --- a/.github/actions/javascript/getPullRequestDetails/index.js +++ b/.github/actions/javascript/getPullRequestDetails/index.js @@ -12178,11 +12178,10 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const { data: comparison } = await this.octokit.repos.compareCommits({ + const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, - base: fromTag, - head: toTag, + basehead: `${fromTag}...${toTag}`, }); // Map API response to our CommitType format return comparison.commits.map((commit) => ({ @@ -12194,7 +12193,7 @@ class GithubUtils { } catch (error) { if (error instanceof request_error_1.RequestError && error.status === 404) { - console.error(`❓❓ Failed to compare commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them. 💡💡`); + console.error(`❓Failed to compare commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them. 💡`); } // Re-throw the error after logging throw error; diff --git a/.github/actions/javascript/isStagingDeployLocked/index.js b/.github/actions/javascript/isStagingDeployLocked/index.js index d9a74cdcadf7..95a2992c5256 100644 --- a/.github/actions/javascript/isStagingDeployLocked/index.js +++ b/.github/actions/javascript/isStagingDeployLocked/index.js @@ -12075,11 +12075,10 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const { data: comparison } = await this.octokit.repos.compareCommits({ + const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, - base: fromTag, - head: toTag, + basehead: `${fromTag}...${toTag}`, }); // Map API response to our CommitType format return comparison.commits.map((commit) => ({ @@ -12091,7 +12090,7 @@ class GithubUtils { } catch (error) { if (error instanceof request_error_1.RequestError && error.status === 404) { - console.error(`❓❓ Failed to compare commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them. 💡💡`); + console.error(`❓Failed to compare commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them. 💡`); } // Re-throw the error after logging throw error; diff --git a/.github/actions/javascript/markPullRequestsAsDeployed/index.js b/.github/actions/javascript/markPullRequestsAsDeployed/index.js index b7fc2a30fb7d..cf48108e896f 100644 --- a/.github/actions/javascript/markPullRequestsAsDeployed/index.js +++ b/.github/actions/javascript/markPullRequestsAsDeployed/index.js @@ -13472,11 +13472,10 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const { data: comparison } = await this.octokit.repos.compareCommits({ + const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, - base: fromTag, - head: toTag, + basehead: `${fromTag}...${toTag}`, }); // Map API response to our CommitType format return comparison.commits.map((commit) => ({ @@ -13488,7 +13487,7 @@ class GithubUtils { } catch (error) { if (error instanceof request_error_1.RequestError && error.status === 404) { - console.error(`❓❓ Failed to compare commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them. 💡💡`); + console.error(`❓Failed to compare commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them. 💡`); } // Re-throw the error after logging throw error; diff --git a/.github/actions/javascript/postTestBuildComment/index.js b/.github/actions/javascript/postTestBuildComment/index.js index f0cd66d45f20..78789324cb1b 100644 --- a/.github/actions/javascript/postTestBuildComment/index.js +++ b/.github/actions/javascript/postTestBuildComment/index.js @@ -12187,11 +12187,10 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const { data: comparison } = await this.octokit.repos.compareCommits({ + const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, - base: fromTag, - head: toTag, + basehead: `${fromTag}...${toTag}`, }); // Map API response to our CommitType format return comparison.commits.map((commit) => ({ @@ -12203,7 +12202,7 @@ class GithubUtils { } catch (error) { if (error instanceof request_error_1.RequestError && error.status === 404) { - console.error(`❓❓ Failed to compare commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them. 💡💡`); + console.error(`❓Failed to compare commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them. 💡`); } // Re-throw the error after logging throw error; diff --git a/.github/actions/javascript/proposalPoliceComment/index.js b/.github/actions/javascript/proposalPoliceComment/index.js index 6b265b528e09..aa453c78bb80 100644 --- a/.github/actions/javascript/proposalPoliceComment/index.js +++ b/.github/actions/javascript/proposalPoliceComment/index.js @@ -18658,11 +18658,10 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const { data: comparison } = await this.octokit.repos.compareCommits({ + const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, - base: fromTag, - head: toTag, + basehead: `${fromTag}...${toTag}`, }); // Map API response to our CommitType format return comparison.commits.map((commit) => ({ @@ -18674,7 +18673,7 @@ class GithubUtils { } catch (error) { if (error instanceof request_error_1.RequestError && error.status === 404) { - console.error(`❓❓ Failed to compare commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them. 💡💡`); + console.error(`❓Failed to compare commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them. 💡`); } // Re-throw the error after logging throw error; diff --git a/.github/actions/javascript/reopenIssueWithComment/index.js b/.github/actions/javascript/reopenIssueWithComment/index.js index 69b269cbabcb..19ff620139e2 100644 --- a/.github/actions/javascript/reopenIssueWithComment/index.js +++ b/.github/actions/javascript/reopenIssueWithComment/index.js @@ -12085,11 +12085,10 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const { data: comparison } = await this.octokit.repos.compareCommits({ + const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, - base: fromTag, - head: toTag, + basehead: `${fromTag}...${toTag}`, }); // Map API response to our CommitType format return comparison.commits.map((commit) => ({ @@ -12101,7 +12100,7 @@ class GithubUtils { } catch (error) { if (error instanceof request_error_1.RequestError && error.status === 404) { - console.error(`❓❓ Failed to compare commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them. 💡💡`); + console.error(`❓Failed to compare commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them. 💡`); } // Re-throw the error after logging throw error; diff --git a/.github/actions/javascript/reviewerChecklist/index.js b/.github/actions/javascript/reviewerChecklist/index.js index a4eac04ddeb3..19dc16186de7 100644 --- a/.github/actions/javascript/reviewerChecklist/index.js +++ b/.github/actions/javascript/reviewerChecklist/index.js @@ -12177,11 +12177,10 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const { data: comparison } = await this.octokit.repos.compareCommits({ + const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, - base: fromTag, - head: toTag, + basehead: `${fromTag}...${toTag}`, }); // Map API response to our CommitType format return comparison.commits.map((commit) => ({ @@ -12193,7 +12192,7 @@ class GithubUtils { } catch (error) { if (error instanceof request_error_1.RequestError && error.status === 404) { - console.error(`❓❓ Failed to compare commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them. 💡💡`); + console.error(`❓Failed to compare commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them. 💡`); } // Re-throw the error after logging throw error; diff --git a/.github/actions/javascript/verifySignedCommits/index.js b/.github/actions/javascript/verifySignedCommits/index.js index 705bd08a3d5d..9d6080102eec 100644 --- a/.github/actions/javascript/verifySignedCommits/index.js +++ b/.github/actions/javascript/verifySignedCommits/index.js @@ -12117,11 +12117,10 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const { data: comparison } = await this.octokit.repos.compareCommits({ + const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, - base: fromTag, - head: toTag, + basehead: `${fromTag}...${toTag}`, }); // Map API response to our CommitType format return comparison.commits.map((commit) => ({ @@ -12133,7 +12132,7 @@ class GithubUtils { } catch (error) { if (error instanceof request_error_1.RequestError && error.status === 404) { - console.error(`❓❓ Failed to compare commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them. 💡💡`); + console.error(`❓Failed to compare commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them. 💡`); } // Re-throw the error after logging throw error; diff --git a/.github/libs/GithubUtils.ts b/.github/libs/GithubUtils.ts index 1cc2f75a681b..1dc0e32ed3ed 100644 --- a/.github/libs/GithubUtils.ts +++ b/.github/libs/GithubUtils.ts @@ -577,11 +577,10 @@ class GithubUtils { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const {data: comparison} = await this.octokit.repos.compareCommits({ + const {data: comparison} = await this.octokit.repos.compareCommitsWithBasehead({ owner: CONST.GITHUB_OWNER, repo: CONST.APP_REPO, - base: fromTag, - head: toTag, + basehead: `${fromTag}...${toTag}`, }); // Map API response to our CommitType format @@ -594,7 +593,7 @@ class GithubUtils { } catch (error) { if (error instanceof RequestError && error.status === 404) { console.error( - `❓❓ Failed to compare commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them. 💡💡`, + `❓Failed to compare commits with the GitHub API. The base tag ('${fromTag}') or head tag ('${toTag}') likely doesn't exist on the remote repository. If this is the case, create or push them. 💡`, ); } // Re-throw the error after logging From 3ab6fa5163c3f433a775cc986bbc27dc02c3e831 Mon Sep 17 00:00:00 2001 From: rory Date: Wed, 14 May 2025 16:14:50 -0700 Subject: [PATCH 2/5] Add pagination to compareCommits --- .github/actions/javascript/authorChecklist/index.js | 2 +- .github/actions/javascript/awaitStagingDeploys/index.js | 2 +- .github/actions/javascript/checkAndroidStatus/index.js | 2 +- .github/actions/javascript/checkDeployBlockers/index.js | 2 +- .github/actions/javascript/createOrUpdateStagingDeploy/index.js | 2 +- .github/actions/javascript/getArtifactInfo/index.js | 2 +- .github/actions/javascript/getDeployPullRequestList/index.js | 2 +- .github/actions/javascript/getPreviousVersion/index.js | 2 +- .github/actions/javascript/getPullRequestDetails/index.js | 2 +- .github/actions/javascript/isStagingDeployLocked/index.js | 2 +- .github/actions/javascript/markPullRequestsAsDeployed/index.js | 2 +- .github/actions/javascript/postTestBuildComment/index.js | 2 +- .github/actions/javascript/proposalPoliceComment/index.js | 2 +- .github/actions/javascript/reopenIssueWithComment/index.js | 2 +- .github/actions/javascript/reviewerChecklist/index.js | 2 +- .github/actions/javascript/verifySignedCommits/index.js | 2 +- .github/libs/GithubUtils.ts | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/actions/javascript/authorChecklist/index.js b/.github/actions/javascript/authorChecklist/index.js index 5a475b3b8677..370fc40e979d 100644 --- a/.github/actions/javascript/authorChecklist/index.js +++ b/.github/actions/javascript/authorChecklist/index.js @@ -16038,7 +16038,7 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ + const comparison = await this.paginate(this.octokit.repos.compareCommitsWithBasehead, { owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, basehead: `${fromTag}...${toTag}`, diff --git a/.github/actions/javascript/awaitStagingDeploys/index.js b/.github/actions/javascript/awaitStagingDeploys/index.js index b58a0bd785dc..591689c38507 100644 --- a/.github/actions/javascript/awaitStagingDeploys/index.js +++ b/.github/actions/javascript/awaitStagingDeploys/index.js @@ -12831,7 +12831,7 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ + const comparison = await this.paginate(this.octokit.repos.compareCommitsWithBasehead, { owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, basehead: `${fromTag}...${toTag}`, diff --git a/.github/actions/javascript/checkAndroidStatus/index.js b/.github/actions/javascript/checkAndroidStatus/index.js index 36a392cc5baf..3cfd1351c434 100644 --- a/.github/actions/javascript/checkAndroidStatus/index.js +++ b/.github/actions/javascript/checkAndroidStatus/index.js @@ -737526,7 +737526,7 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ + const comparison = await this.paginate(this.octokit.repos.compareCommitsWithBasehead, { owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, basehead: `${fromTag}...${toTag}`, diff --git a/.github/actions/javascript/checkDeployBlockers/index.js b/.github/actions/javascript/checkDeployBlockers/index.js index db1a3810f788..b7de21e5da26 100644 --- a/.github/actions/javascript/checkDeployBlockers/index.js +++ b/.github/actions/javascript/checkDeployBlockers/index.js @@ -12114,7 +12114,7 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ + const comparison = await this.paginate(this.octokit.repos.compareCommitsWithBasehead, { owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, basehead: `${fromTag}...${toTag}`, diff --git a/.github/actions/javascript/createOrUpdateStagingDeploy/index.js b/.github/actions/javascript/createOrUpdateStagingDeploy/index.js index 3a2782e9d65e..fb6095e0f59d 100644 --- a/.github/actions/javascript/createOrUpdateStagingDeploy/index.js +++ b/.github/actions/javascript/createOrUpdateStagingDeploy/index.js @@ -12351,7 +12351,7 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ + const comparison = await this.paginate(this.octokit.repos.compareCommitsWithBasehead, { owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, basehead: `${fromTag}...${toTag}`, diff --git a/.github/actions/javascript/getArtifactInfo/index.js b/.github/actions/javascript/getArtifactInfo/index.js index e0b1b010621e..64457c569d72 100644 --- a/.github/actions/javascript/getArtifactInfo/index.js +++ b/.github/actions/javascript/getArtifactInfo/index.js @@ -12075,7 +12075,7 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ + const comparison = await this.paginate(this.octokit.repos.compareCommitsWithBasehead, { owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, basehead: `${fromTag}...${toTag}`, diff --git a/.github/actions/javascript/getDeployPullRequestList/index.js b/.github/actions/javascript/getDeployPullRequestList/index.js index d86032bd04e3..341f2c12b2ac 100644 --- a/.github/actions/javascript/getDeployPullRequestList/index.js +++ b/.github/actions/javascript/getDeployPullRequestList/index.js @@ -12364,7 +12364,7 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ + const comparison = await this.paginate(this.octokit.repos.compareCommitsWithBasehead, { owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, basehead: `${fromTag}...${toTag}`, diff --git a/.github/actions/javascript/getPreviousVersion/index.js b/.github/actions/javascript/getPreviousVersion/index.js index 97fa0e2b15ab..ba4d271352d1 100644 --- a/.github/actions/javascript/getPreviousVersion/index.js +++ b/.github/actions/javascript/getPreviousVersion/index.js @@ -12219,7 +12219,7 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ + const comparison = await this.paginate(this.octokit.repos.compareCommitsWithBasehead, { owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, basehead: `${fromTag}...${toTag}`, diff --git a/.github/actions/javascript/getPullRequestDetails/index.js b/.github/actions/javascript/getPullRequestDetails/index.js index a6eb3d611c17..ccd3ba24daf5 100644 --- a/.github/actions/javascript/getPullRequestDetails/index.js +++ b/.github/actions/javascript/getPullRequestDetails/index.js @@ -12178,7 +12178,7 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ + const comparison = await this.paginate(this.octokit.repos.compareCommitsWithBasehead, { owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, basehead: `${fromTag}...${toTag}`, diff --git a/.github/actions/javascript/isStagingDeployLocked/index.js b/.github/actions/javascript/isStagingDeployLocked/index.js index 95a2992c5256..fb8015363f77 100644 --- a/.github/actions/javascript/isStagingDeployLocked/index.js +++ b/.github/actions/javascript/isStagingDeployLocked/index.js @@ -12075,7 +12075,7 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ + const comparison = await this.paginate(this.octokit.repos.compareCommitsWithBasehead, { owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, basehead: `${fromTag}...${toTag}`, diff --git a/.github/actions/javascript/markPullRequestsAsDeployed/index.js b/.github/actions/javascript/markPullRequestsAsDeployed/index.js index cf48108e896f..c1a2046bf28d 100644 --- a/.github/actions/javascript/markPullRequestsAsDeployed/index.js +++ b/.github/actions/javascript/markPullRequestsAsDeployed/index.js @@ -13472,7 +13472,7 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ + const comparison = await this.paginate(this.octokit.repos.compareCommitsWithBasehead, { owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, basehead: `${fromTag}...${toTag}`, diff --git a/.github/actions/javascript/postTestBuildComment/index.js b/.github/actions/javascript/postTestBuildComment/index.js index 78789324cb1b..beb5afe959dc 100644 --- a/.github/actions/javascript/postTestBuildComment/index.js +++ b/.github/actions/javascript/postTestBuildComment/index.js @@ -12187,7 +12187,7 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ + const comparison = await this.paginate(this.octokit.repos.compareCommitsWithBasehead, { owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, basehead: `${fromTag}...${toTag}`, diff --git a/.github/actions/javascript/proposalPoliceComment/index.js b/.github/actions/javascript/proposalPoliceComment/index.js index aa453c78bb80..201ee0fb9677 100644 --- a/.github/actions/javascript/proposalPoliceComment/index.js +++ b/.github/actions/javascript/proposalPoliceComment/index.js @@ -18658,7 +18658,7 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ + const comparison = await this.paginate(this.octokit.repos.compareCommitsWithBasehead, { owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, basehead: `${fromTag}...${toTag}`, diff --git a/.github/actions/javascript/reopenIssueWithComment/index.js b/.github/actions/javascript/reopenIssueWithComment/index.js index 19ff620139e2..87b31b666deb 100644 --- a/.github/actions/javascript/reopenIssueWithComment/index.js +++ b/.github/actions/javascript/reopenIssueWithComment/index.js @@ -12085,7 +12085,7 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ + const comparison = await this.paginate(this.octokit.repos.compareCommitsWithBasehead, { owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, basehead: `${fromTag}...${toTag}`, diff --git a/.github/actions/javascript/reviewerChecklist/index.js b/.github/actions/javascript/reviewerChecklist/index.js index 19dc16186de7..26b171057464 100644 --- a/.github/actions/javascript/reviewerChecklist/index.js +++ b/.github/actions/javascript/reviewerChecklist/index.js @@ -12177,7 +12177,7 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ + const comparison = await this.paginate(this.octokit.repos.compareCommitsWithBasehead, { owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, basehead: `${fromTag}...${toTag}`, diff --git a/.github/actions/javascript/verifySignedCommits/index.js b/.github/actions/javascript/verifySignedCommits/index.js index 9d6080102eec..652bff7bbba8 100644 --- a/.github/actions/javascript/verifySignedCommits/index.js +++ b/.github/actions/javascript/verifySignedCommits/index.js @@ -12117,7 +12117,7 @@ class GithubUtils { static async getCommitHistoryBetweenTags(fromTag, toTag) { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const { data: comparison } = await this.octokit.repos.compareCommitsWithBasehead({ + const comparison = await this.paginate(this.octokit.repos.compareCommitsWithBasehead, { owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, basehead: `${fromTag}...${toTag}`, diff --git a/.github/libs/GithubUtils.ts b/.github/libs/GithubUtils.ts index 1dc0e32ed3ed..7d2bf1f20a56 100644 --- a/.github/libs/GithubUtils.ts +++ b/.github/libs/GithubUtils.ts @@ -577,7 +577,7 @@ class GithubUtils { console.log('Getting pull requests merged between the following tags:', fromTag, toTag); try { - const {data: comparison} = await this.octokit.repos.compareCommitsWithBasehead({ + const comparison = await this.paginate(this.octokit.repos.compareCommitsWithBasehead, { owner: CONST.GITHUB_OWNER, repo: CONST.APP_REPO, basehead: `${fromTag}...${toTag}`, From 2ad616218d456ab7fbd8e3b3628666d6c5691d63 Mon Sep 17 00:00:00 2001 From: rory Date: Wed, 14 May 2025 16:28:03 -0700 Subject: [PATCH 3/5] fix tests --- tests/unit/CIGitLogicTest.ts | 47 ++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/tests/unit/CIGitLogicTest.ts b/tests/unit/CIGitLogicTest.ts index 071ef69d1d7f..c9089935b49d 100644 --- a/tests/unit/CIGitLogicTest.ts +++ b/tests/unit/CIGitLogicTest.ts @@ -73,14 +73,18 @@ function initGithubAPIMocking() { }); // Mock various compareCommits responses with single mocked function - jest.spyOn(GithubUtils.octokit.repos, 'compareCommits').mockImplementation((params) => { - const base = params?.base; - const head = params?.head; - const tagPairKey = `${base}...${head}`; + jest.spyOn(GithubUtils, 'paginate').mockImplementation((method, p) => { + if (method !== GithubUtils.octokit.repos.compareCommitsWithBasehead) { + throw new Error(`Paginate called for unmocked method ${method}`); + } + + const params = p as Parameters[0]; + + const basehead = params?.basehead; // eslint-disable-next-line @typescript-eslint/no-explicit-any const mockCommits: any[] = (() => { - switch (tagPairKey) { + switch (basehead) { case '2.0.0-0...2.0.0-1-staging': return [{sha: 'sha_pr1_merge', commit: {message: 'Merge pull request #1 from Expensify/pr-1', author: {name: 'Test Author'}}, author: {login: 'testuser'}}]; case '2.0.0-0...2.0.0-2-staging': @@ -168,31 +172,26 @@ function initGithubAPIMocking() { {sha: 'sha_pr15_merge', commit: {message: 'Merge pull request #15 from Expensify/pr-15', author: {name: 'Test Author'}}, author: {login: 'testuser'}}, ]; default: - console.warn(`Unhandled tag pair in compareCommits mock: ${tagPairKey}`); + console.warn(`Unhandled tag pair in compareCommits mock: ${basehead}`); return []; } })(); return Promise.resolve({ - data: { - url: '', - html_url: '', - permalink_url: '', - diff_url: '', - patch_url: '', - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any - base_commit: {} as any, - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any - merge_base_commit: {} as any, - status: mockCommits.length > 0 ? 'ahead' : ('identical' as const), - ahead_by: mockCommits.length, - behind_by: 0, - total_commits: mockCommits.length, - commits: mockCommits, - }, - status: 200 as const, - headers: {}, url: '', + html_url: '', + permalink_url: '', + diff_url: '', + patch_url: '', + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any + base_commit: {} as any, + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any + merge_base_commit: {} as any, + status: mockCommits.length > 0 ? 'ahead' : ('identical' as const), + ahead_by: mockCommits.length, + behind_by: 0, + total_commits: mockCommits.length, + commits: mockCommits, }); }); } From 55e73e01db7eb3c64333463a47323cfdb09f69cc Mon Sep 17 00:00:00 2001 From: rory Date: Wed, 14 May 2025 16:29:50 -0700 Subject: [PATCH 4/5] Fix mocks in GithubUtilsTest --- tests/unit/GithubUtilsTest.ts | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/tests/unit/GithubUtilsTest.ts b/tests/unit/GithubUtilsTest.ts index 5894a059f520..52c434f097f2 100644 --- a/tests/unit/GithubUtilsTest.ts +++ b/tests/unit/GithubUtilsTest.ts @@ -628,27 +628,23 @@ describe('GithubUtils', () => { const commitHistoryData = { emptyResponse: { - data: { - commits: [], - }, + commits: [], }, singleCommit: { - data: { - commits: [ - { - sha: 'abc123', - commit: { - message: 'Test commit message', - author: { - name: 'Test Author', - }, - }, + commits: [ + { + sha: 'abc123', + commit: { + message: 'Test commit message', author: { - login: 'testuser', + name: 'Test Author', }, }, - ], - }, + author: { + login: 'testuser', + }, + }, + ], }, expectedFormattedCommit: [ { From e12f771871d4b5631f8ba81a33f8760335f5656e Mon Sep 17 00:00:00 2001 From: rory Date: Wed, 14 May 2025 16:43:59 -0700 Subject: [PATCH 5/5] fix types and mocks in tests --- tests/unit/CIGitLogicTest.ts | 2 +- tests/unit/GithubUtilsTest.ts | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/unit/CIGitLogicTest.ts b/tests/unit/CIGitLogicTest.ts index c9089935b49d..2e1db26ab760 100644 --- a/tests/unit/CIGitLogicTest.ts +++ b/tests/unit/CIGitLogicTest.ts @@ -75,7 +75,7 @@ function initGithubAPIMocking() { // Mock various compareCommits responses with single mocked function jest.spyOn(GithubUtils, 'paginate').mockImplementation((method, p) => { if (method !== GithubUtils.octokit.repos.compareCommitsWithBasehead) { - throw new Error(`Paginate called for unmocked method ${method}`); + throw new Error(`Paginate called for unmocked method ${method.name}`); } const params = p as Parameters[0]; diff --git a/tests/unit/GithubUtilsTest.ts b/tests/unit/GithubUtilsTest.ts index 52c434f097f2..4f0b414cefe8 100644 --- a/tests/unit/GithubUtilsTest.ts +++ b/tests/unit/GithubUtilsTest.ts @@ -676,7 +676,15 @@ describe('GithubUtils', () => { compareCommits: mockCompareCommits, // Use the mock function here }, }, - paginate: jest.fn(), + paginate: jest.fn().mockImplementation((method, p) => { + if (method !== GithubUtils.octokit.repos.compareCommitsWithBasehead) { + throw new Error(`Paginate called for unmocked method ${(method as {name: string}).name}`); + } + + const params = p as Parameters[0]; + // eslint-disable-next-line @typescript-eslint/no-unsafe-return + return mockCompareCommits(params); + }), } as unknown as InternalOctokit; // Prevent the real initOctokit from running and overwriting our mock