fix(dev-infra): fetch 100 branches from Github instead of 30 (#42658)

This commit fixes an issue with the ng-dev tool, where Github's API returns
paginated branch data. Only 30 branches are returned by default, and Angular
now has more than 30 branches in its repo. This commit increases the number
of branches returned to the API limit of 100, which should buy us some time
until we can implement proper pagination.

PR Close #42658
This commit is contained in:
Alex Rickabaugh 2021-06-24 15:10:39 -07:00 committed by Jessica Janiuk
parent 6e84ede412
commit 261b060fa1
2 changed files with 7 additions and 3 deletions

View File

@ -885,7 +885,9 @@ function getVersionForVersionBranch(branchName) {
*/
function getBranchesForMajorVersions(repo, majorVersions) {
return tslib.__awaiter(this, void 0, void 0, function* () {
const { data: branchData } = yield repo.api.repos.listBranches({ owner: repo.owner, repo: repo.name, protected: true });
// TODO(alxhub): actually paginate this, since eventually the number of branches we have will run
// off the end of the first page of data returned by `listBranches`.
const { data: branchData } = yield repo.api.repos.listBranches({ owner: repo.owner, repo: repo.name, protected: true, per_page: 100 });
const branches = [];
for (const { name } of branchData) {
if (!isVersionBranch(name)) {

View File

@ -67,8 +67,10 @@ export function getVersionForVersionBranch(branchName: string): semver.SemVer|nu
*/
export async function getBranchesForMajorVersions(
repo: GithubRepoWithApi, majorVersions: number[]): Promise<VersionBranch[]> {
const {data: branchData} =
await repo.api.repos.listBranches({owner: repo.owner, repo: repo.name, protected: true});
// TODO(alxhub): actually paginate this, since eventually the number of branches we have will run
// off the end of the first page of data returned by `listBranches`.
const {data: branchData} = await repo.api.repos.listBranches(
{owner: repo.owner, repo: repo.name, protected: true, per_page: 100});
const branches: VersionBranch[] = [];
for (const {name} of branchData) {