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

Function getReposForOrgs

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

Source from the content-addressed store, hash-verified

158}
159
160const getReposForOrgs = async <T>(orgs: string[], api: Api<T>) => {
161 const results = await Promise.allSettled(orgs.map(async (org) => {
162 try {
163 logger.debug(`Fetching repos for org ${org}...`);
164
165 const { durationMs, data } = await measure(() =>
166 paginate((page) => api.orgs.orgListRepos(org, {
167 limit: 100,
168 page,
169 }))
170 );
171
172 logger.debug(`Found ${data.length} repos for org ${org} in ${durationMs}ms.`);
173 return {
174 type: 'valid' as const,
175 data
176 };
177 } catch (e: any) {
178 Sentry.captureException(e);
179
180 if (e?.status === 404) {
181 const warning = `Organization ${org} not found or no access`;
182 logger.warn(warning);
183 return {
184 type: 'warning' as const,
185 warning
186 };
187 }
188 throw e;
189 }
190 }));
191
192 throwIfAnyFailed(results);
193 const { validItems: repos, warnings } = processPromiseResults<GiteaRepository>(results);
194
195 return {
196 repos,
197 warnings,
198 };
199}
200
201const getRepos = async <T>(repoList: string[], api: Api<T>) => {
202 const results = await Promise.allSettled(repoList.map(async (repo) => {

Callers 1

getGiteaReposFromConfigFunction · 0.70

Calls 4

paginateFunction · 0.85
throwIfAnyFailedFunction · 0.85
processPromiseResultsFunction · 0.85
measureFunction · 0.70

Tested by

no test coverage detected