From 3fbf5430f8676e6fd1289231b48d72c312f10ae5 Mon Sep 17 00:00:00 2001 From: KrishP147 Date: Wed, 23 Sep 2026 22:00:31 -0400 Subject: [PATCH] ci: gate deploy-backend on Supabase secrets presence Skip Setup CLI + Deploy steps when SUPABASE_ACCESS_TOKEN/PROJECT_REF unset, add needs frontend-tests. Co-Authored-By: Claude Opus 5.5 (1M context) --- .github/workflows/ci.yml | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a8c602f..7ca208e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -97,6 +97,7 @@ jobs: deploy-backend: name: Deploy Backend to Supabase Edge Functions + needs: [frontend-tests] runs-on: ubuntu-latest if: github.ref == 'refs/heads/main' && github.event_name == 'push' @@ -104,16 +105,33 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + # Requires SUPABASE_ACCESS_TOKEN and SUPABASE_PROJECT_REF repo secrets - + # generate a token at https://supabase.com/dashboard/account/tokens and + # add both yourself under Settings > Secrets and variables > Actions. + # Not set by this workflow or by any automated process. Deploy steps + # below are skipped when either secret is unset. + - name: Check Supabase secrets + id: check + env: + SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }} + SUPABASE_PROJECT_REF: ${{ secrets.SUPABASE_PROJECT_REF }} + run: | + if [ -n "$SUPABASE_ACCESS_TOKEN" ] && [ -n "$SUPABASE_PROJECT_REF" ]; then + echo "has_secrets=true" >> "$GITHUB_OUTPUT" + else + echo "has_secrets=false" >> "$GITHUB_OUTPUT" + echo "::notice::Supabase secrets unset, skipping Edge Functions deploy" + fi + exit 0 + - name: Setup Supabase CLI + if: steps.check.outputs.has_secrets == 'true' uses: supabase/setup-cli@v1 with: version: latest - # Requires a SUPABASE_ACCESS_TOKEN repo secret - generate one at - # https://supabase.com/dashboard/account/tokens and add it yourself - # under Settings > Secrets and variables > Actions. Not set by this - # workflow or by any automated process. - name: Deploy Edge Functions + if: steps.check.outputs.has_secrets == 'true' run: supabase functions deploy --project-ref "$SUPABASE_PROJECT_REF" env: SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}