Skip to content

Setting up Authentication

Cyb3r Jak3 edited this page Jul 11, 2021 · 2 revisions

API Token

Follow this guide to generate an API Token for use with action.

  1. Log in to Cloudflare and go to My Profile -> API Tokens Generate Custom Token
  2. The permissions for the token need to be set to Zone -> Cache Purge -> Purge
    Cloudflare API Token permissons
  3. Once the token has been created, copy it into a secret on Github and you will be able to use it.

Example workflow:

    - name: Clear Cloudflare cache
      uses: Cyb3r-Jak3/action-cloudflare-cache@<Latest Release>
      env:
        zone: ${{ secrets.CLOUDFLARE_ZONE }}
        api_token: ${{ secrets.CLOUDFLARE_TOKEN }}

Global Token

Follow this guide to use the Global Auth method.

  1. Log in to Cloudflare and go to My Profile -> API Tokens -> Global API Key
  2. You will need to enter your password to get the key.
  3. Copy that key into a secret on Github and you will be able to use it.

Example Workflow:

    - name: Clear Cloudflare cache
      uses: Cyb3r-Jak3/cloudflare-cache-cleaner@<Latest Release>
      env:
        zone: ${{ secrets.CLOUDFLARE_ZONE }}
        email: ${{ secrets.CLOUDFLARE_EMAIL }}
        global_token: ${{ secrets.CLOUDFLARE_KEY }}
Clone this wiki locally