This action is not longer supported. Please switch to my new action
A Github Action that clears cache from Cloudflare. Useful for after deployment as new code will be pulled from your server rather than served from Cloudflare.
All sensitive information like zones and tokens should be stored with encrypted secrets
Your zone ID will be on the bottom right of the overview page.
There are two ways that you can provide authentication for Cloudflare, Global Token or API Token. It is strongly recommended to use API Token over Global API Key. To get a walk through guide of getting set up with Authentication then check out the wiki.
The only permissions required for an API Token is Zone -> Cache Purge -> Purge
. You can set this for all zones but best pratice would be restricting to the zone in use. Right now there is no method for running with multiple zones.
name: Deploy Site
on: push
jobs:
deploy:
runs-on: ubuntu-latest
steps:
# Put steps here to build your site, check, and deploy your site.
- name: Clear Cloudflare cache
uses: Cyb3r-Jak3/clear-cloudflare-cache@0.0.1
env:
# Zone is required by both methods
zone: ${{ secrets.CLOUDFLARE_ZONE }}
# Using API Token
api_token: ${{ secrets.CLOUDFLARE_TOKEN }}
# Using Global Token
email: ${{ secrets.CLOUDFLARE_EMAIL }}
global_token: ${{ secrets.CLOUDFLARE_KEY }}