From 665469eae2fffe6d6475da783034b02244742c0a Mon Sep 17 00:00:00 2001 From: meh Date: Wed, 30 Sep 2026 00:30:27 +0700 Subject: [PATCH] ci: purge the Bunny CDN zone on every deploy One POST to the pull-zone purge endpoint, reading BUNNYCDN_ZONE_ID (or BUNNYCDN_DEV_ZONE_ID where that is the secret the repo has). Some pipelines read a secret the repo does not have, so Bunny answered "The request is invalid." and nothing was purged. --- .github/workflows/pipeline.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 2e39053..13d9f06 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -40,17 +40,16 @@ jobs: - name: Upload to BunnyCDN. env: STORAGE_API_KEY: ${{ secrets.BUNNYCDN_STORAGE_API_KEY }} - ZONE_API_KEY: ${{ secrets.BUNNYCDN_ZONE_API_KEY }} - ZONE_ID: ${{ secrets.BUNNYCDN_DEV_ZONE_ID }} STORAGE_NAME: ${{ secrets.BUNNYCDN_STORAGE_NAME }} run: | cd dist for file in $(find . -type f); do curl -X PUT -H "AccessKey: $STORAGE_API_KEY" -T "$file" "https://storage.bunnycdn.com/$STORAGE_NAME/$file" done - curl -X POST \ - -H "AccessKey: $ZONE_API_KEY" \ - -H "Content-Type: application/json" \ - -H "Accept: application/json" \ - "https://bunnycdn.com/api/pullzone/$ZONE_ID/purgeCache" \ - -d "{\"id\":$ZONE_ID}" + + - name: Purge Bunny CDN + env: + ZONE_API_KEY: ${{ secrets.BUNNYCDN_ZONE_API_KEY }} + ZONE_ID: ${{ secrets.BUNNYCDN_ZONE_ID || secrets.BUNNYCDN_DEV_ZONE_ID }} + run: | + curl -sS -X POST -H "AccessKey: $ZONE_API_KEY" "https://api.bunny.net/pullzone/$ZONE_ID/purgeCache"