MCPcopy Index your code
hub / github.com/sourcebot-dev/sourcebot / shouldExcludeRepo

Function shouldExcludeRepo

packages/backend/src/gitea.ts:78–118  ·  view source on GitHub ↗
({
    repo,
    exclude
} : {
    repo: GiteaRepository,
    exclude?: {
        forks?: boolean,
        archived?: boolean,
        repos?: string[],
    }
})

Source from the content-addressed store, hash-verified

76}
77
78const 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
120const getReposOwnedByUsers = async <T>(users: string[], api: Api<T>) => {
121 const results = await Promise.allSettled(users.map(async (user) => {

Callers 1

getGiteaReposFromConfigFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected