From 1237a71807795fae5e39b5b80a688c536169d74a Mon Sep 17 00:00:00 2001 From: gujiangjiang Date: Fri, 17 Oct 2025 05:12:27 +0800 Subject: [PATCH] =?UTF-8?q?=20fix:=20=E4=BF=AE=E6=AD=A3=20GitHub=20Action?= =?UTF-8?q?=20=E9=83=A8=E7=BD=B2=E8=84=9A=E6=9C=AC=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=AF=86=E9=92=A5=E6=A3=80=E6=9F=A5=E6=AD=A5=E9=AA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index a5943fb..56ae75c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -53,8 +53,21 @@ jobs: TURNSTILE_KEY: ${{ secrets.TURNSTILE_KEY }} TURNSTILE_SECRET: ${{ secrets.TURNSTILE_SECRET }} + # 检查 Cloudflare 密钥是否存在 + - name: Check for Cloudflare credentials + id: cf_creds + run: | + if [ -z "${{ secrets.CF_API_TOKEN }}" ] || [ -z "${{ secrets.CF_ACCOUNT_ID }}" ]; then + echo "Cloudflare credentials not found, skipping deployment." + echo "has_creds=false" >> $GITHUB_ENV + else + echo "has_creds=true" >> $GITHUB_ENV + fi + # 部署到 Cloudflare Workers - name: Deploy + # 添加此条件判断:仅在 has_creds 为 'true' 时执行此步骤 + if: env.has_creds == 'true' uses: cloudflare/wrangler-action@v3 with: apiToken: ${{ secrets.CF_API_TOKEN }}