Skip to content
This repository has been archived by the owner on Jul 11, 2021. It is now read-only.

Cyb3r-Jak3/Clear-Cloudflare-Cache

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧹 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 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

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 }}