diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..ef38cd3 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,30 @@ +name: Keep Render Service Alive + +on: + workflow_dispatch: # run manually + push: + branches: + - main # or whichever branch you deploy from + +jobs: + qstash-keepalive: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Install curl + run: sudo apt-get install -y curl + + - name: Create/Update QStash schedule + env: + QSTASH_TOKEN: ${{ secrets.QSTASH_TOKEN }} + run: | + curl -X POST "https://qstash-us-east-1.upstash.io/v1/schedules" \ + -H "Authorization: Bearer $QSTASH_TOKEN" \ + -H "Content-Type: application/json" \ + -d '{ + "cron": "*/14 * * * *", + "destination": "https://eltes.onrender.com/health", + "method": "GET" + }' diff --git a/app/api/health/route.ts b/app/api/health/route.ts new file mode 100644 index 0000000..180e1d4 --- /dev/null +++ b/app/api/health/route.ts @@ -0,0 +1,6 @@ +// app/api/health/route.ts +import { NextResponse } from "next/server"; + +export async function GET() { + return NextResponse.json({ status: "OK" }, { status: 200 }); +}