refactor(bitbucket): use paginated api for commit statuses (#22329)

This commit is contained in:
Adam Setch 2023-05-22 03:33:12 -04:00 committed by GitHub
parent 5597560c92
commit 48d4cf3e18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -375,13 +375,15 @@ async function getStatus(
memCache = true
): Promise<BitbucketStatus[]> {
const sha = await getBranchCommit(branchName);
return utils.accumulateValues<BitbucketStatus>(
// TODO: types (#7154)
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
`/2.0/repositories/${config.repository}/commit/${sha}/statuses`,
'get',
{ memCache }
);
return (
await bitbucketHttp.getJson<PagedResult<BitbucketStatus>>(
`/2.0/repositories/${config.repository}/commit/${sha!}/statuses`,
{
paginate: true,
memCache,
}
)
).body.values;
}
// Returns the combined status for a branch.
export async function getBranchStatus(