Fix public and private repos

pull/1/head
Nelson Dane 2023-02-03 01:29:38 -05:00
parent 416988e568
commit 5d837c0dbc
4 changed files with 726 additions and 136 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
.idea/
node_modules/
.secrets.rc
.vscode/

View File

@ -1,7 +1,8 @@
FROM node:lts-alpine
WORKDIR /app
COPY package.json package-lock.json ./
COPY package.json package-lock.json .
RUN npm ci
COPY . .
COPY docker-entrypoint.sh .
COPY src ./src
CMD [ "/app/docker-entrypoint.sh" ]

850
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -8,12 +8,12 @@ async function getGithubRepositories(username, token, mirrorPrivateRepositories)
auth: token || null,
});
const publicRepositoriesWithForks = await octokit.paginate('GET /users/:username/repos', { username: username })
const publicRepositoriesWithForks = await octokit.paginate('GET /user/repos?visibility=public&affiliation=owner&visibility=public', { username: username })
.then(repositories => toRepositoryList(repositories));
let allRepositoriesWithoutForks;
if(mirrorPrivateRepositories === 'true'){
allRepositoriesWithoutForks = await octokit.paginate('GET /search/repositories?q=user:{username}', { username : username })
allRepositoriesWithoutForks = await octokit.paginate('GET /user/repos?visibility=public&affiliation=owner&visibility=private', { username : username })
.then(repositories => toRepositoryList(repositories));
}
@ -104,7 +104,7 @@ async function main() {
return;
}
const giteaToken = process.env.GITEA_TOKE;
const giteaToken = process.env.GITEA_TOKEN;
if (!giteaToken) {
console.error('No GITEA_TOKEN specified, please specify! Exiting..');
return;