Skip to content

Purge Cloudflare cache #2457

Purge Cloudflare cache

Purge Cloudflare cache #2457

name: Purge Cloudflare cache
on:
deployment_status:
workflow_dispatch:
jobs:
purge-cache:
if: github.event_name == 'workflow_dispatch' || (github.event.deployment_status.state == 'success' && github.event.deployment_status.environment == 'Production – guild-xyz')
runs-on: ubuntu-latest
steps:
- name: Clear Cloudflare cache
run: curl --request POST --url https://api.cloudflare.com/client/v4/zones/${{secrets.CLOUDFLARE_ZONE_ID}}/purge_cache --header 'Content-Type:application/json' --header 'X-Auth-Email:${{secrets.CLOUDFLARE_X_AUTH_EMAIL}}' --header 'X-Auth-Key:${{secrets.CLOUDFLARE_X_AUTH_KEY}}' --data '{"purge_everything":true}'