项目作者: Cyb3r-Jak3

项目描述 :
Github Action to purge any cache from Cloudflare
高级语言: Shell
项目地址: git://github.com/Cyb3r-Jak3/Clear-Cloudflare-Cache.git
创建时间: 2021-01-02T02:18:47Z
项目社区:https://github.com/Cyb3r-Jak3/Clear-Cloudflare-Cache

开源协议:Mozilla Public License 2.0

下载


🧹 Clear Cloudflare Cache 🧹

This action is not longer supported. Please switch to my new action

No Maintenance Intended

Action Test

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.

Configuration

All sensitive information like zones and tokens should be stored with @latest/actions/reference/encrypted-secrets">encrypted secrets

Zone ID

Your zone ID will be on the bottom right of the overview page.

Image of blurred out Zone ID

Setting up Authentication

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.

API Token permissons.

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.

Example workflow

  1. name: Deploy Site
  2. on: push
  3. jobs:
  4. deploy:
  5. runs-on: ubuntu-latest
  6. steps:
  7. # Put steps here to build your site, check, and deploy your site.
  8. - name: Clear Cloudflare cache
  9. uses: Cyb3r-Jak3/clear-cloudflare-cache@0.0.1
  10. env:
  11. # Zone is required by both methods
  12. zone: ${{ secrets.CLOUDFLARE_ZONE }}
  13. # Using API Token
  14. api_token: ${{ secrets.CLOUDFLARE_TOKEN }}
  15. # Using Global Token
  16. email: ${{ secrets.CLOUDFLARE_EMAIL }}
  17. global_token: ${{ secrets.CLOUDFLARE_KEY }}