MCPcopy Create free account
hub / github.com/Autonoma-AI/autonoma / buildGitHubApp

Function buildGitHubApp

apps/api/src/github/github-app.ts:9–34  ·  view source on GitHub ↗
(env: ApiEnv)

Source from the content-addressed store, hash-verified

7type ApiEnv = typeof apiEnv;
8
9export function buildGitHubApp(env: ApiEnv): GitHubApp {
10 if (env.LOCAL_DEV) {
11 logger.info("LOCAL_DEV=true - using LocalDevGitHubApp (fake GitHub integration)");
12 return new LocalDevGitHubApp();
13 }
14
15 const missing = getMissingGitHubCredentials(env);
16 if (missing.length > 0) {
17 throw new Error(
18 `Missing GitHub app credentials: ${missing.join(", ")}. Set them, or set LOCAL_DEV=true to use the fake app.`,
19 );
20 }
21
22 // Postgres-backed ETag store enables conditional requests (free 304s) on every GitHub call.
23 const etagStore = new PrismaEtagStore(db);
24
25 return new OctokitGitHubApp(
26 {
27 appId: env.GITHUB_APP_ID!,
28 privateKey: env.GITHUB_APP_PRIVATE_KEY!,
29 webhookSecret: env.GITHUB_APP_WEBHOOK_SECRET!,
30 appSlug: env.GITHUB_APP_SLUG!,
31 },
32 etagStore,
33 );
34}
35
36function getMissingGitHubCredentials(env: ApiEnv): string[] {
37 const missing: string[] = [];

Callers 4

context.tsFile · 0.90
diffs-service.tsFile · 0.90

Calls 2

infoMethod · 0.45

Tested by

no test coverage detected