diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 35865e7..15c6c30 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -32,9 +32,10 @@ jobs: steps: - name: Update environment secrets in Cloudflare run: | - REPO_NAME=$(echo "${{ github.event.repository.name }}" | tr '.' '-') + REPOSITORY_NAME=${{ github.repository }} + REPOSITORY_NAME=${REPOSITORY_NAME//./-} curl -X PUT \ - "https://api.cloudflare.com/client/v4/accounts/${{ secrets.CLOUDFLARE_ACCOUNT_ID }}/pages/projects/${REPO_NAME}/deployment_configs" \ + "https://api.cloudflare.com/client/v4/accounts/${{ secrets.CLOUDFLARE_ACCOUNT_ID }}/pages/projects/" + ${REPOSITORY_NAME} + "/deployment_configs" \ -H "Authorization: Bearer ${{ secrets.CLOUDFLARE_API_TOKEN }}" \ -H "Content-Type: application/json" \ --data '{ diff --git a/functions/issue-scraper.ts b/functions/issue-scraper.ts index b8d7c26..55f7382 100644 --- a/functions/issue-scraper.ts +++ b/functions/issue-scraper.ts @@ -1,4 +1,4 @@ -import { Context, Env } from "./types"; +import { Context } from "./types"; export const corsHeaders = { "Access-Control-Allow-Origin": "*", @@ -7,16 +7,16 @@ export const corsHeaders = { }; - -export async function onRequest(ctx: Context, env: Env): Promise { - const { request } = ctx; +export async function onRequest(ctx: Context): Promise { + const { request, env } = ctx; const url = new URL(request.url); + try { switch (request.method) { case "GET": if (url.searchParams.has("key")) { const key = url.searchParams.get("key") as string; - return new Response("GET request with key: " + key + JSON.stringify(env.SUPABASE_ANON_KEY), { + return new Response("GET request with key: " + key + JSON.stringify(env), { headers: corsHeaders, status: 200, });