Skip to content

Commit 169c403

Browse files
committed
Skip Cloudflare deploy steps when CLOUDFLARE_API_TOKEN is not configured
1 parent 3d37cbe commit 169c403

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ on:
99
jobs:
1010
build-and-deploy:
1111
runs-on: ubuntu-latest
12+
env:
13+
HAS_CF_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN != '' }}
1214

1315
steps:
1416
- name: Checkout code
@@ -44,15 +46,15 @@ jobs:
4446
run: uv run python render.py Examples.build.ipynb
4547

4648
- name: Deploy to Cloudflare Pages (Production)
47-
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
49+
if: github.ref == 'refs/heads/master' && github.event_name == 'push' && env.HAS_CF_TOKEN == 'true'
4850
uses: cloudflare/wrangler-action@v3
4951
with:
5052
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
5153
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
5254
command: pages deploy web --project-name=pythonplot --branch=main
5355

5456
- name: Deploy to Cloudflare Pages (Preview)
55-
if: github.ref != 'refs/heads/master'
57+
if: github.ref != 'refs/heads/master' && env.HAS_CF_TOKEN == 'true'
5658
uses: cloudflare/wrangler-action@v3
5759
with:
5860
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}

0 commit comments

Comments
 (0)