Fix Public Repos without auth

Change API endpoint to allow the pulling of public repos without a Github token. Also remove unneeded username reference.
main
Nelson Dane 2023-02-04 10:23:59 -05:00
parent 445b9642ca
commit a1c89bfcee
1 changed files with 2 additions and 2 deletions

View File

@ -8,12 +8,12 @@ async function getGithubRepositories(username, token, mirrorPrivateRepositories)
auth: token || null,
});
const publicRepositoriesWithForks = await octokit.paginate('GET /user/repos?visibility=public&affiliation=owner&visibility=public', { username: username })
const publicRepositoriesWithForks = await octokit.paginate('GET /users/:username/repos', { username: username })
.then(repositories => toRepositoryList(repositories));
let allRepositoriesWithoutForks;
if(mirrorPrivateRepositories === 'true'){
allRepositoriesWithoutForks = await octokit.paginate('GET /user/repos?visibility=public&affiliation=owner&visibility=private', { username : username })
allRepositoriesWithoutForks = await octokit.paginate('GET /user/repos?visibility=public&affiliation=owner&visibility=private')
.then(repositories => toRepositoryList(repositories));
}