MCPcopy Create free account
hub / github.com/sourcebot-dev/sourcebot / serverShouldExcludeRepo

Function serverShouldExcludeRepo

packages/backend/src/bitbucket.ts:589–623  ·  view source on GitHub ↗
(repo: BitbucketRepository, config: BitbucketConnectionConfig)

Source from the content-addressed store, hash-verified

587}
588
589export function serverShouldExcludeRepo(repo: BitbucketRepository, config: BitbucketConnectionConfig): boolean {
590 const serverRepo = repo as ServerRepository;
591
592 const projectName = serverRepo.project!.key;
593 const repoSlug = serverRepo.slug!;
594 const repoName = `${projectName}/${repoSlug}`;
595 let reason = '';
596
597 const shouldExclude = (() => {
598 if (config.exclude?.repos) {
599 if (micromatch.isMatch(repoName, config.exclude.repos)) {
600 reason = `\`exclude.repos\` contains ${repoName}`;
601 return true;
602 }
603 }
604
605 if (!!config.exclude?.archived && serverRepo.archived) {
606 reason = `\`exclude.archived\` is true`;
607 return true;
608 }
609
610 if (!!config.exclude?.forks && serverRepo.origin !== undefined) {
611 reason = `\`exclude.forks\` is true`;
612 return true;
613 }
614
615 return false;
616 })();
617
618 if (shouldExclude) {
619 logger.debug(`Excluding repo ${repoName}. Reason: ${reason}`);
620 return true;
621 }
622 return false;
623}
624
625/**
626 * Returns the account IDs of users who have been *explicitly* granted permission on a Bitbucket Cloud repository.

Callers 1

bitbucket.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected