(visibility: 'all' | 'private' | 'public' = 'all', octokit: Octokit)
| 240 | * @see: https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#list-repositories-for-the-authenticated-user |
| 241 | */ |
| 242 | export 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. |
no test coverage detected