Skip to content

[HOLD] [NoQA] Paginate all commits manually #62150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions .github/actions/javascript/authorChecklist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 21 additions & 6 deletions .github/actions/javascript/awaitStagingDeploys/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 21 additions & 6 deletions .github/actions/javascript/checkAndroidStatus/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 21 additions & 6 deletions .github/actions/javascript/checkDeployBlockers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 21 additions & 6 deletions .github/actions/javascript/createOrUpdateStagingDeploy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 21 additions & 6 deletions .github/actions/javascript/getArtifactInfo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 21 additions & 6 deletions .github/actions/javascript/getDeployPullRequestList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 21 additions & 6 deletions .github/actions/javascript/getPreviousVersion/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 21 additions & 6 deletions .github/actions/javascript/getPullRequestDetails/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 21 additions & 6 deletions .github/actions/javascript/isStagingDeployLocked/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading
Loading