* Resolves the in-scope repositories for the project, caching them on the sync * context so a single sync reuses one listing. Disabled repositories and, when a * filter is set, non-matching repositories are excluded.
( accessToken: string, organization: string, project: string, repositoryFilter: string, syncContext?: Record<string, unknown> )
| 731 | * filter is set, non-matching repositories are excluded. |
| 732 | */ |
| 733 | async function resolveRepositories( |
| 734 | accessToken: string, |
| 735 | organization: string, |
| 736 | project: string, |
| 737 | repositoryFilter: string, |
| 738 | syncContext?: Record<string, unknown> |
| 739 | ): Promise<GitRepository[]> { |
| 740 | const cached = syncContext?.repositories as GitRepository[] | undefined |
| 741 | const all = |
| 742 | cached ?? (await listRepositories(accessToken, organization, project, undefined, syncContext)) |
| 743 | if (syncContext && !cached) syncContext.repositories = all |
| 744 | |
| 745 | const needle = repositoryFilter.toLowerCase() |
| 746 | return all.filter((repo) => { |
| 747 | if (repo.isDisabled) return false |
| 748 | if (!needle) return true |
| 749 | return repo.id.toLowerCase() === needle || (repo.name ?? '').toLowerCase() === needle |
| 750 | }) |
| 751 | } |
| 752 | |
| 753 | /** |
| 754 | * Lists every blob in a repository at the given branch via the non-paginated |
no test coverage detected