diff --git a/src/github.ts b/src/github.ts index 72f7b66..a6f3825 100644 --- a/src/github.ts +++ b/src/github.ts @@ -148,19 +148,3 @@ export const addBackportDoneLabel = async (prNumber: number) => { }`, ); }; - -// trigger GitHub action using workflow_dispatch -export const triggerBackportAction = async () => { - const response = await fetch( - `${GITHUB_API}/repos/yardenshoham/gitea-backporter/actions/workflows/backport.yml/dispatches`, - { - method: "POST", - headers: HEADERS, - body: JSON.stringify({ ref: "main" }), - }, - ); - if (!response.ok) { - throw new Error(`Failed to trigger backport action: ${response.status}`); - } - console.log(`Triggered backport action`); -}; diff --git a/src/webhook.ts b/src/webhook.ts index 932ecdd..091e22b 100644 --- a/src/webhook.ts +++ b/src/webhook.ts @@ -1,15 +1,7 @@ import { serve } from "https://deno.land/std@0.178.0/http/server.ts"; -import { triggerBackportAction } from "./github.ts"; - -if (Deno.env.get("BACKPORTER_GITHUB_TOKEN") === undefined) { - console.error("BACKPORTER_GITHUB_TOKEN is not set"); -} serve(async (req: Request) => { - if (req.url.endsWith("/trigger")) { - await triggerBackportAction(); - return Response.json({ message: "Triggered backport" }); - } else { - return Response.json({ status: "OK" }); - } + const json = await req.json(); + console.log(json); + return Response.json({ status: "OK" }); });