({
repo,
exclude
} : {
repo: GiteaRepository,
exclude?: {
forks?: boolean,
archived?: boolean,
repos?: string[],
}
})
| 76 | } |
| 77 | |
| 78 | const shouldExcludeRepo = ({ |
| 79 | repo, |
| 80 | exclude |
| 81 | } : { |
| 82 | repo: GiteaRepository, |
| 83 | exclude?: { |
| 84 | forks?: boolean, |
| 85 | archived?: boolean, |
| 86 | repos?: string[], |
| 87 | } |
| 88 | }) => { |
| 89 | let reason = ''; |
| 90 | const repoName = repo.full_name!; |
| 91 | |
| 92 | const shouldExclude = (() => { |
| 93 | if (!!exclude?.forks && repo.fork) { |
| 94 | reason = `\`exclude.forks\` is true`; |
| 95 | return true; |
| 96 | } |
| 97 | |
| 98 | if (!!exclude?.archived && !!repo.archived) { |
| 99 | reason = `\`exclude.archived\` is true`; |
| 100 | return true; |
| 101 | } |
| 102 | |
| 103 | if (exclude?.repos) { |
| 104 | if (micromatch.isMatch(repoName, exclude.repos)) { |
| 105 | reason = `\`exclude.repos\` contains ${repoName}`; |
| 106 | return true; |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | return false; |
| 111 | })(); |
| 112 | |
| 113 | if (shouldExclude) { |
| 114 | logger.debug(`Excluding repo ${repoName}. Reason: ${reason}`); |
| 115 | } |
| 116 | |
| 117 | return shouldExclude; |
| 118 | } |
| 119 | |
| 120 | const getReposOwnedByUsers = async <T>(users: string[], api: Api<T>) => { |
| 121 | const results = await Promise.allSettled(users.map(async (user) => { |
no outgoing calls
no test coverage detected