From d11c725f5f01e26df121aa0192d2c22847460d8a Mon Sep 17 00:00:00 2001 From: Markus Keil Date: Thu, 21 Mar 2024 18:37:06 +0100 Subject: [PATCH] make ensure org less intrusive --- src/index.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/index.js b/src/index.js index 3bcd832..ee5ac96 100644 --- a/src/index.js +++ b/src/index.js @@ -118,7 +118,7 @@ async function mirror(repository, gitea, giteaUser, githubToken, giteaOwner) { return; } console.log('Mirroring repository to gitea: ', repository.name); - await ensureOrg(gitea, giteaOwner,() => mirrorOnGitea(repository, gitea, giteaUser, githubToken, giteaOwner)); + await mirrorOnGitea(repository, gitea, giteaUser, githubToken, giteaOwner); } async function createMirrorsOnGitea(githubRepositories, githubUsername) { @@ -140,13 +140,15 @@ async function createMirrorsOnGitea(githubRepositories, githubUsername) { token: giteaToken, }; const giteaUser = await getGiteaUser(gitea); - - const queue = new PQueue({ concurrency: 1 }); - await queue.addAll(githubRepositories.map(repository => { - return async () => { - await mirror(repository, gitea, giteaUser, githubToken, githubUsername); - }; - })); + ensureOrg(gitea, giteaOwner,() => { + const queue = new PQueue({ concurrency: 1 }); + await queue.addAll(githubRepositories.map(repository => { + return async () => { + await mirror(repository, gitea, giteaUser, githubToken, githubUsername); + }; + })); + + }) }