MCPcopy Index your code
hub / github.com/sourcebot-dev/sourcebot / getRepos

Function getRepos

packages/backend/src/gitea.ts:201–238  ·  view source on GitHub ↗
(repoList: string[], api: Api<T>)

Source from the content-addressed store, hash-verified

199}
200
201const getRepos = async <T>(repoList: string[], api: Api<T>) => {
202 const results = await Promise.allSettled(repoList.map(async (repo) => {
203 try {
204 logger.debug(`Fetching repository info for ${repo}...`);
205
206 const [owner, repoName] = repo.split('/');
207 const { durationMs, data: response } = await measure(() =>
208 api.repos.repoGet(owner, repoName),
209 );
210
211 logger.debug(`Found repo ${repo} in ${durationMs}ms.`);
212 return {
213 type: 'valid' as const,
214 data: [response.data]
215 };
216 } catch (e: any) {
217 Sentry.captureException(e);
218
219 if (e?.status === 404) {
220 const warning = `Repository ${repo} not found or no access`;
221 logger.warn(warning);
222 return {
223 type: 'warning' as const,
224 warning
225 };
226 }
227 throw e;
228 }
229 }));
230
231 throwIfAnyFailed(results);
232 const { validItems: repos, warnings } = processPromiseResults<GiteaRepository>(results);
233
234 return {
235 repos,
236 warnings,
237 };
238}
239
240// @see : https://docs.gitea.com/development/api-usage#pagination
241const paginate = async <T>(request: (page: number) => Promise<HttpResponse<T[], any>>) => {

Callers 1

getGiteaReposFromConfigFunction · 0.70

Calls 3

throwIfAnyFailedFunction · 0.85
processPromiseResultsFunction · 0.85
measureFunction · 0.70

Tested by

no test coverage detected