From c2254077c46587c23975825d06dfc52a6ca8b065 Mon Sep 17 00:00:00 2001 From: Shai Almog <67850168+shai-almog@users.noreply.github.com> Date: Fri, 13 Feb 2026 15:51:46 +0200 Subject: [PATCH] Skip Cloudflare deploy when API token is missing --- .github/workflows/website-docs.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/website-docs.yml b/.github/workflows/website-docs.yml index 0f4aed0797..7bd0641768 100644 --- a/.github/workflows/website-docs.yml +++ b/.github/workflows/website-docs.yml @@ -72,13 +72,23 @@ jobs: path: docs/website/public if-no-files-found: error + - name: Check Cloudflare deploy credentials + if: ${{ github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master') && (secrets.CLOUDFLARE_API_TOKEN == '' && secrets.CF_API_TOKEN == '') }} + run: | + echo "::warning::Skipping Cloudflare Pages deploy because no API token secret is configured. Set CLOUDFLARE_API_TOKEN (preferred) or CF_API_TOKEN." + - name: Deploy to Cloudflare Pages - if: ${{ github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master') }} + if: ${{ github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master') && (secrets.CLOUDFLARE_API_TOKEN != '' || secrets.CF_API_TOKEN != '') }} uses: cloudflare/wrangler-action@v3 + env: + # Keep these env vars explicit so Wrangler can authenticate in non-interactive CI. + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN || secrets.CF_API_TOKEN }} + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID || secrets.CF_ACCOUNT_ID }} with: - apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} - accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + # Also pass through action inputs for compatibility with wrangler-action versions. + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN || secrets.CF_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID || secrets.CF_ACCOUNT_ID }} command: >- pages deploy docs/website/public - --project-name=${{ vars.CLOUDFLARE_PAGES_PROJECT_NAME || secrets.CLOUDFLARE_PAGES_PROJECT_NAME || 'codenameone' }} + --project-name=${{ vars.CLOUDFLARE_PAGES_PROJECT_NAME || secrets.CLOUDFLARE_PAGES_PROJECT_NAME || secrets.CF_PAGES_PROJECT_NAME || 'codenameone' }} --branch=${{ github.ref_name }}