MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / isGitHubRepositoryLinked

Function isGitHubRepositoryLinked

apps/web/src/lib/bot/platforms/github.ts:56–74  ·  view source on GitHub ↗
(
  integration: PlatformIntegration,
  repository: GitHubRepositoryReference
)

Source from the content-addressed store, hash-verified

54 fullName:
55 repository?.full_name ??
56 parseGitHubRepositoryFullName(thread.id) ??
57 parseGitHubRepositoryFullName(thread.channelId),
58 };
59}
60
61export function isGitHubRepositoryLinked(
62 integration: PlatformIntegration,
63 repository: GitHubRepositoryReference
64): boolean {
65 if (repository.id === null && repository.fullName === null) return false;
66
67 if (integration.repository_access === 'all') return true;
68 if (integration.repository_access !== 'selected') return false;
69
70 const repositories = integration.repositories ?? [];
71 return repositories.some(linkedRepository => {
72 if (repository.id !== null && linkedRepository.id === repository.id) return true;
73
74 return (
75 repository.fullName !== null &&
76 linkedRepository.full_name.toLowerCase() === repository.fullName.toLowerCase()
77 );

Callers 2

github.test.tsFile · 0.90
canHandleMessageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected