Skip to content

Commit

Permalink
refactor(bitbucket): use paginated api for getRepos (#22275)
Browse files Browse the repository at this point in the history
  • Loading branch information
setchy committed May 21, 2023
1 parent ec0bddd commit 2ccf030
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/modules/platform/bitbucket/index.ts
Expand Up @@ -114,9 +114,14 @@ export async function initPlatform({
export async function getRepos(): Promise<string[]> {
logger.debug('Autodiscovering Bitbucket Cloud repositories');
try {
const repos = await utils.accumulateValues<{ full_name: string }>(
`/2.0/repositories/?role=contributor`
);
const repos = (
await bitbucketHttp.getJson<PagedResult<RepoInfoBody>>(
`/2.0/repositories/?role=contributor`,
{
paginate: true,
}
)
).body.values;
return repos.map((repo) => repo.full_name);
} catch (err) /* istanbul ignore next */ {
logger.error({ err }, `bitbucket getRepos error`);
Expand Down
1 change: 1 addition & 0 deletions lib/modules/platform/bitbucket/types.ts
Expand Up @@ -62,6 +62,7 @@ export interface RepoInfoBody {
mainbranch: { name: string };
has_issues: boolean;
uuid: string;
full_name: string;
}

export interface PrResponse {
Expand Down

0 comments on commit 2ccf030

Please sign in to comment.