From cfb2b99c624a49c3e07376f2e886a51df107216b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=A2=E3=83=AC=E3=82=AF=E3=82=B5=E3=83=B3=E3=83=80?= =?UTF-8?q?=E3=83=BC=2Eeth?= Date: Sat, 3 Feb 2024 03:32:46 +0900 Subject: [PATCH] chore: remove authentication test --- src/authentication.ts | 19 ------------------- src/worker.ts | 13 ------------- 2 files changed, 32 deletions(-) delete mode 100644 src/authentication.ts 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,