A fast GitHub action (python+composite run) to purge CloudFlare cache.
If you are running it from a custom container (e.g. not ubuntu-latest
or similar provided by GitHub), this container needs to have python installed.
All sensitive variables should be set as encrypted secrets in the action's configuration.
- name: Purge cache
uses: aorfanos/cloudflare-purge-action@v1.0.3
env:
CF_TOKEN: ${{ secrets.CF_TOKEN }}
CF_ZONE_NAME: ${{ secrets.CF_ZONE_NAME }}
- name: Purge cache
uses: aorfanos/cloudflare-purge-action@v1.0.3
env:
CF_EMAIL_ADDR: ${{ secrets.CF_EMAIL_ADDR }}
CF_API_KEY: ${{ secrets.CF_API_KEY }}
CF_ZONE_NAME: ${{ secrets.CF_ZONE_NAME }}
Just specify authentication and zone name to purge everything.
To purge only specific files, you can pass an array of fully qualified URLs via the environment variable named CF_PURGE_URLS
.
CF_PURGE_URLS: '["https://aorfanos.com/styles.css","https://aorfanos.com/style.css"]'
CF_PURGE_HOSTS: '["https://aorfanos.com","https://blog.aorfanos.com"]'
CF_PURGE_TAGS: '["some-tag","another-tag"]'
CF_PURGE_PREFIXES: '["https://aorfanos.com/css","https://aorfanos.com/js"]'