mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fix(dev-infra): use API pagination for retrieving project branches (#42666)
We rely on a Github API `/branches` request to determine the active release trains. Currently this logic is broken if more than 100 protected branches exist within a repository. This issue surfaced recently where the `items_per_page` setting was set to `30`, causing the merge tooling and release tooling to not detect the proper "latest" release train. This commit uses Github pagination for retrieving branches to determine the active release trains, and makes the logic more long-term proof. PR Close #42666
This commit is contained in:
committed by
Jessica Janiuk
parent
279e63f65f
commit
f29fe5ced0
+1
-3
@@ -899,9 +899,7 @@ function getVersionForVersionBranch(branchName) {
|
||||
*/
|
||||
function getBranchesForMajorVersions(repo, majorVersions) {
|
||||
return tslib.__awaiter(this, void 0, void 0, function* () {
|
||||
// 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 branchData = yield repo.api.paginate(repo.api.repos.listBranches, { owner: repo.owner, repo: repo.name, protected: true });
|
||||
const branches = [];
|
||||
for (const { name } of branchData) {
|
||||
if (!isVersionBranch(name)) {
|
||||
|
||||
Reference in New Issue
Block a user