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

Function getReposOwnedByUsers

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

Source from the content-addressed store, hash-verified

118}
119
120const getReposOwnedByUsers = async <T>(users: string[], api: Api<T>) => {
121 const results = await Promise.allSettled(users.map(async (user) => {
122 try {
123 logger.debug(`Fetching repos for user ${user}...`);
124
125 const { durationMs, data } = await measure(() =>
126 paginate((page) => api.users.userListRepos(user, {
127 page,
128 }))
129 );
130
131 logger.debug(`Found ${data.length} repos owned by user ${user} in ${durationMs}ms.`);
132 return {
133 type: 'valid' as const,
134 data
135 };
136 } catch (e: any) {
137 Sentry.captureException(e);
138
139 if (e?.status === 404) {
140 const warning = `User ${user} not found or no access`;
141 logger.warn(warning);
142 return {
143 type: 'warning' as const,
144 warning
145 };
146 }
147 throw e;
148 }
149 }));
150
151 throwIfAnyFailed(results);
152 const { validItems: repos, warnings } = processPromiseResults<GiteaRepository>(results);
153
154 return {
155 repos,
156 warnings,
157 };
158}
159
160const getReposForOrgs = async <T>(orgs: string[], api: Api<T>) => {
161 const results = await Promise.allSettled(orgs.map(async (org) => {

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