()
| 169 | |
| 170 | const { durationMs, data } = await measure(async () => { |
| 171 | const fetchFn = async () => { |
| 172 | const orgUrl = buildOrgUrl(baseUrl, org, useTfsPath); |
| 173 | const connection = createAzureDevOpsConnection(orgUrl, token); // useTfsPath already handled in orgUrl |
| 174 | |
| 175 | const coreApi = await connection.getCoreApi(); |
| 176 | const gitApi = await connection.getGitApi(); |
| 177 | |
| 178 | const projects = await coreApi.getProjects(); |
| 179 | const allRepos: GitRepository[] = []; |
| 180 | for (const project of projects) { |
| 181 | if (!project.id) { |
| 182 | logger.warn(`Encountered project in org ${org} with no id: ${project.name}`); |
| 183 | continue; |
| 184 | } |
| 185 | |
| 186 | try { |
| 187 | const repos = await gitApi.getRepositories(project.id); |
| 188 | allRepos.push(...repos); |
| 189 | } catch (error) { |
| 190 | logger.warn(`Failed to fetch repositories for project ${project.name}: ${error}`); |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | return allRepos; |
| 195 | }; |
| 196 | |
| 197 | return fetchWithRetry(fetchFn, `organization ${org}`, logger); |
| 198 | }); |
nothing calls this directly
no test coverage detected