purge-cache.yml 645 B

12345678910111213141516171819
  1. name: Purge CF Cache
  2. on: [deployment_status]
  3. jobs:
  4. purge_cache:
  5. name: Purge CF Cache
  6. runs-on: ubuntu-latest
  7. if: ${{ github.event.deployment_status.state == 'success' && github.event.deployment_status.environment == 'Production' }}
  8. steps:
  9. - uses: actions/checkout@v2
  10. - name: Call CF
  11. env:
  12. CF_ZONE_ID: ${{ secrets.CF_ZONE_ID }}
  13. run: |
  14. curl -X POST https://api.cloudflare.com/client/v4/zones/$CF_ZONE_ID/purge_cache \
  15. -d '{"purge_everything":true}' \
  16. -H "Content-Type: application/json" \
  17. -H "Authorization: Bearer ${{ secrets.CF_AUTH_KEY }}" \