diff --git a/.github/workflows/cloudflare.yml b/.github/workflows/cloudflare.yml index 3778630..b13e5c0 100644 --- a/.github/workflows/cloudflare.yml +++ b/.github/workflows/cloudflare.yml @@ -3,7 +3,13 @@ name: Deploy to Cloudflare Pages on: push: branches: - - master + - '**' + pull_request: + +permissions: + contents: read + deployments: write + pull-requests: write jobs: deploy: @@ -40,7 +46,9 @@ jobs: with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - command: pages deploy + command: pages deploy --branch=${{ env.BRANCH_NAME }} + gitHubToken: ${{ secrets.GITHUB_TOKEN }} env: CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} - CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} \ No newline at end of file + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} \ No newline at end of file diff --git a/nuxt.config.ts b/nuxt.config.ts index aec8567..2067300 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -97,7 +97,12 @@ export default defineNuxtConfig({ }, routeRules: { - '/api/activity': { swr: 3 }, + '/api/activity': { + proxy: `${process.env.NUXT_API_URL}/api/activity` + }, + '/api/stats': { + proxy: `${process.env.NUXT_API_URL}/api/stats` + } }, nitro: { diff --git a/server/api/activity.get.ts b/server/api/activity.get.ts deleted file mode 100644 index ff26bad..0000000 --- a/server/api/activity.get.ts +++ /dev/null @@ -1,4 +0,0 @@ -export default defineEventHandler(async (event) => { - const config = useRuntimeConfig(event) - return await $fetch(`${config.api.url}/api/activity`) -}) \ No newline at end of file diff --git a/server/api/stats.get.ts b/server/api/stats.get.ts deleted file mode 100644 index af893db..0000000 --- a/server/api/stats.get.ts +++ /dev/null @@ -1,4 +0,0 @@ -export default defineEventHandler(async (event) => { - const config = useRuntimeConfig(event) - return await $fetch(`${config.api.url}/api/stats`) -}) \ No newline at end of file diff --git a/server/tsconfig.json b/server/tsconfig.json deleted file mode 100644 index a177e33..0000000 --- a/server/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../.nuxt/tsconfig.server.json" -} \ No newline at end of file