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