diff --git a/src/authentication.ts b/src/authentication.ts deleted file mode 100644 index 8f2c0c3..0000000 --- a/src/authentication.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { createAppAuth } from "@octokit/auth-app"; -import { Env } from "./types/env"; -export async function authenticateApp(env: Env, installationId: number): Promise { - try { - const auth = createAppAuth({ - appId: env.APP_ID, - privateKey: env.PRIVATE_KEY, - installationId: installationId, - }); - - // Authenticate the app - const authentication = await auth({ type: "app" }); - - console.log("Successfully authenticated as app", authentication); - } catch (error) { - console.error("Failed to authenticate app", error); - throw error; - } -} diff --git a/src/worker.ts b/src/worker.ts index 1c07dec..d205a28 100644 --- a/src/worker.ts +++ b/src/worker.ts @@ -1,6 +1,5 @@ import { EmitterWebhookEventName as WebhookEventName, emitterEventNames } from "@octokit/webhooks"; import { Value } from "@sinclair/typebox/value"; -import { authenticateApp } from "./authentication"; import { EventHandler } from "./event-handler"; import { bindHandlers } from "./handlers"; import { Env, envSchema } from "./types/env"; @@ -12,18 +11,6 @@ export default { const eventName = getEventName(request); const signatureSHA256 = getSignature(request); const id = getId(request); - // Parse the request body to get the webhook event payload - const payload = JSON.parse(await request.text()); - - // Extract the installationId from the payload - const installationId = payload.installation?.id; - - if (!installationId) { - throw new Error("Missing installation ID"); - } - - // Authenticate the app - await authenticateApp(env, installationId); const eventHandler = new EventHandler({ webhookSecret: env.WEBHOOK_SECRET,