(client: BitbucketClient, repoList: string[])
| 321 | } |
| 322 | |
| 323 | async function cloudGetRepos(client: BitbucketClient, repoList: string[]): Promise<{repos: CloudRepository[], warnings: string[]}> { |
| 324 | const results = await Promise.allSettled(repoList.map(async (repo) => { |
| 325 | const [workspace, repo_slug] = repo.split('/'); |
| 326 | if (!workspace || !repo_slug) { |
| 327 | const warning = `Invalid repo ${repo}`; |
| 328 | logger.warn(warning); |
| 329 | return { |
| 330 | type: 'warning' as const, |
| 331 | warning |
| 332 | }; |
| 333 | } |
| 334 | |
| 335 | logger.debug(`Fetching repo ${repo_slug} for workspace ${workspace}...`); |
| 336 | try { |
| 337 | const path = `/repositories/${workspace}/${repo_slug}` as CloudGetRequestPath; |
| 338 | const data = await fetchWithRetry(async () => { |
| 339 | const { data } = await client.apiClient.GET(path); |
| 340 | return data; |
| 341 | }, `repo ${repo}`, logger); |
| 342 | return { |
| 343 | type: 'valid' as const, |
| 344 | data: [data] |
| 345 | }; |
| 346 | } catch (e: any) { |
| 347 | Sentry.captureException(e); |
| 348 | logger.error(`Failed to fetch repo ${repo}: ${e}`); |
| 349 | |
| 350 | if (e?.status === 404) { |
| 351 | const warning = `Repo ${repo} not found in ${workspace} or invalid access`; |
| 352 | logger.warn(warning); |
| 353 | return { |
| 354 | type: 'warning' as const, |
| 355 | warning |
| 356 | }; |
| 357 | } |
| 358 | throw e; |
| 359 | } |
| 360 | })); |
| 361 | |
| 362 | throwIfAnyFailed(results); |
| 363 | const { validItems: repos, warnings } = processPromiseResults(results); |
| 364 | return { |
| 365 | repos, |
| 366 | warnings |
| 367 | }; |
| 368 | } |
| 369 | |
| 370 | export function cloudShouldExcludeRepo(repo: BitbucketRepository, config: BitbucketConnectionConfig): boolean { |
| 371 | const cloudRepo = repo as CloudRepository; |
nothing calls this directly
no test coverage detected