(repoList: string[], octokit: Octokit, signal: AbortSignal, url?: string)
| 427 | } |
| 428 | |
| 429 | const getRepos = async (repoList: string[], octokit: Octokit, signal: AbortSignal, url?: string) => { |
| 430 | const results = await Promise.allSettled(repoList.map((repo) => githubQueryLimit(async () => { |
| 431 | try { |
| 432 | const [owner, repoName] = repo.split('/'); |
| 433 | logger.debug(`Fetching repository info for ${repo}...`); |
| 434 | |
| 435 | const octokitToUse = await getOctokitWithGithubApp(octokit, owner, url, `repo ${repo}`); |
| 436 | const { durationMs, data: result } = await measure(async () => { |
| 437 | const fetchFn = () => octokitToUse.repos.get({ |
| 438 | owner, |
| 439 | repo: repoName, |
| 440 | request: { |
| 441 | signal |
| 442 | } |
| 443 | }); |
| 444 | |
| 445 | return fetchWithRetry(fetchFn, repo, logger); |
| 446 | }); |
| 447 | |
| 448 | logger.debug(`Found info for repository ${repo} in ${durationMs}ms`); |
| 449 | return { |
| 450 | type: 'valid' as const, |
| 451 | data: [result.data] |
| 452 | }; |
| 453 | |
| 454 | } catch (error) { |
| 455 | Sentry.captureException(error); |
| 456 | logger.error(`Failed to fetch repository ${repo}.`, error); |
| 457 | |
| 458 | if (isHttpError(error, 404)) { |
| 459 | const warning = `Repository ${repo} not found or no access`; |
| 460 | logger.warn(warning); |
| 461 | return { |
| 462 | type: 'warning' as const, |
| 463 | warning |
| 464 | }; |
| 465 | } |
| 466 | throw error; |
| 467 | } |
| 468 | }))); |
| 469 | |
| 470 | throwIfAnyFailed(results); |
| 471 | const { validItems: repos, warnings } = processPromiseResults<OctokitRepository>(results); |
| 472 | |
| 473 | return { |
| 474 | repos, |
| 475 | warnings, |
| 476 | }; |
| 477 | } |
| 478 | |
| 479 | export const shouldExcludeRepo = ({ |
| 480 | repo, |
no test coverage detected