Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cyb3r-jak3/action-cloudflare-cache
Github Action to purge Cloudflare cache
https://github.com/cyb3r-jak3/action-cloudflare-cache
cloudflare cloudflare-api github-actions
Last synced: 3 months ago
JSON representation
Github Action to purge Cloudflare cache
- Host: GitHub
- URL: https://github.com/cyb3r-jak3/action-cloudflare-cache
- Owner: Cyb3r-Jak3
- License: mpl-2.0
- Created: 2021-07-11T00:39:16.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-06-21T21:05:59.000Z (7 months ago)
- Last Synced: 2024-10-31T10:49:14.746Z (3 months ago)
- Topics: cloudflare, cloudflare-api, github-actions
- Language: TypeScript
- Homepage: https://github.com/marketplace/actions/cloudflare-cache-cleaner
- Size: 993 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cloudflare Cache Cleaner
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 senstive information like zones and tokens should be stored with [encrypted secrets](https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets)**
### Zone ID
Your zone ID will be on the bottom right of the overview page.
![Image of blurred out Zone ID](.github/imgs/Cloudflare_Zone_ID.png)
### 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](https://github.com/Cyb3r-Jak3/action-cloudflare-cache/wiki/Setting-up-Authentication).
#### 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
```yaml
name: Deploy Site
on: pushjobs:
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/action-cloudflare-cache@
with:
# 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 }}
```## Keep up-to-date with GitHub Dependabot
Since [Dependabot](https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-github-dependabot)
has [native GitHub Actions support](https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#package-ecosystem),
to enable it on your GitHub repo all you need to do is add the `.github/dependabot.yml` file:```yaml
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
```