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

Function getReposForAuthenticatedUser

packages/backend/src/github.ts:242–256  ·  view source on GitHub ↗
(visibility: 'all' | 'private' | 'public' = 'all', octokit: Octokit)

Source from the content-addressed store, hash-verified

240 * @see: https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#list-repositories-for-the-authenticated-user
241 */
242export const getReposForAuthenticatedUser = async (visibility: 'all' | 'private' | 'public' = 'all', octokit: Octokit) => {
243 try {
244 const fetchFn = () => octokit.paginate(octokit.repos.listForAuthenticatedUser, {
245 per_page: 100,
246 visibility,
247 });
248
249 const repos = await fetchWithRetry(fetchFn, `authenticated user`, logger);
250 return repos;
251 } catch (error) {
252 Sentry.captureException(error);
253 logger.error(`Failed to fetch repositories for authenticated user.`, error);
254 throw error;
255 }
256}
257
258/**
259 * Gets OAuth scopes for a GitHub token.

Callers 1

Calls 1

fetchWithRetryFunction · 0.70

Tested by

no test coverage detected