{"id":13533390,"url":"https://github.com/jakejarvis/cloudflare-purge-action","last_synced_at":"2025-10-04T18:32:32.356Z","repository":{"id":65155547,"uuid":"203578147","full_name":"jakejarvis/cloudflare-purge-action","owner":"jakejarvis","description":"🗑️ GitHub Action to purge a website's cache via the Cloudflare API","archived":false,"fork":false,"pushed_at":"2022-10-30T21:24:47.000Z","size":77,"stargazers_count":136,"open_issues_count":5,"forks_count":20,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-16T10:24:12.856Z","etag":null,"topics":["actions","ci","cloudflare","deployment","github-actions"],"latest_commit_sha":null,"homepage":"https://github.com/marketplace/actions/cloudflare-purge-cache","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jakejarvis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-21T12:20:24.000Z","updated_at":"2025-01-09T13:07:14.000Z","dependencies_parsed_at":"2023-01-13T15:42:30.112Z","dependency_job_id":null,"html_url":"https://github.com/jakejarvis/cloudflare-purge-action","commit_stats":{"total_commits":18,"total_committers":2,"mean_commits":9.0,"dds":0.5,"last_synced_commit":"eee6dba0236093358f25bb1581bd615dc8b3d8e3"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakejarvis%2Fcloudflare-purge-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakejarvis%2Fcloudflare-purge-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakejarvis%2Fcloudflare-purge-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakejarvis%2Fcloudflare-purge-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jakejarvis","download_url":"https://codeload.github.com/jakejarvis/cloudflare-purge-action/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235293317,"owners_count":18966552,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actions","ci","cloudflare","deployment","github-actions"],"created_at":"2024-08-01T07:01:19.402Z","updated_at":"2025-10-04T18:32:27.038Z","avatar_url":"https://github.com/jakejarvis.png","language":"Shell","funding_links":[],"categories":["Community Resources","Shell"],"sub_categories":["Deployment"],"readme":"# GitHub Action to Purge Cloudflare Cache  🗑️ \n\n\u003e **⚠️ Note:** To use this action, you must have access to the [GitHub Actions](https://github.com/features/actions) feature. GitHub Actions are currently only available in public beta. You can [apply for the GitHub Actions beta here](https://github.com/features/actions/signup/).\n\nThis simple action calls the [Cloudflare API](https://api.cloudflare.com/#zone-purge-all-files) to purge the cache of your website, which can be a helpful last step after deploying a new version.\n\n\n## Usage\n\nAll sensitive variables should be [set as encrypted secrets](https://help.github.com/en/articles/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables) in the action's configuration.\n\n\n### Configuration Variables\n\n| Key | Value | Suggested Type | Required |\n| ------------- | ------------- | ------------- | ------------- |\n| `CLOUDFLARE_ZONE` | **Required for both methods below.** The Zone ID of your domain, which can be found in the right sidebar of your domain's overview page on the Cloudflare dashboard. For example, `xyz321xyz321xyz321xyz321xyz321xy`. | `secret` | **Yes** |\n| `PURGE_URLS` | **Optional.** An array of **fully qualified URLs** to purge. For example: `[\"https://jarv.is/style.css\", \"https://jarv.is/favicon.ico\"]`. If unset, the action will purge everything (which is suggested — [more info below](#purging-specific-files)). | `env` | No |\n\n\n### Authentication Variables\n\nBoth authentication methods below require you to grab information from the [API Tokens page in the dashboard](https://dash.cloudflare.com/profile/api-tokens). Details on the inner workings of each method can be found [in Cloudflare's API docs](https://api.cloudflare.com/#getting-started-requests).\n\n\n#### Option 1: Restricted API Token\n\nAPI Tokens are [a new feature](https://blog.cloudflare.com/api-tokens-general-availability/) as of August 2019. They allow you to restrict the scope of this action to only purging the cache of zones you specify. In other words, this is much safer than allowing this action complete control of your entire Cloudflare account. (I'm not evil though, I promise. 😊)\n\n| Key | Value | Type |\n| ------------- | ------------- | ------------- |\n| `CLOUDFLARE_TOKEN` | The restricted API Token with permissions to purge the cache of one or more zones. | `secret` |\n\nCreating a token can be tricky, so here's what you should enter [on this page](https://dash.cloudflare.com/profile/api-tokens) to create a token for purging the cache of a single domain on your account:\n\n![Creating an API Token for purging](tokens.png)\n\n\n#### Option 2: Global API Key\n\nThis is the \"traditional\" method of authenticating — simply grab your \"Global API Key\" from [the dashboard](https://dash.cloudflare.com/profile/api-tokens). Using this method also **requires a second environment variable** with the email address linked to your account.\n\n| Key | Value | Type |\n| ------------- | ------------- | ------------- |\n| `CLOUDFLARE_EMAIL` | The email address you registered your Cloudflare account with. For example, `me@example.com`. | `secret` |\n| `CLOUDFLARE_KEY` | Your Cloudflare API key, which can be generated using [these instructions](https://support.cloudflare.com/hc/en-us/articles/200167836-Where-do-I-find-my-Cloudflare-API-key-). | `secret` |\n\n\n### `workflow.yml` Example\n\nPlace in a `.yml` file such as this one in your `.github/workflows` folder. [Refer to the documentation on workflow YAML syntax here.](https://help.github.com/en/articles/workflow-syntax-for-github-actions)\n\n```yaml\nname: Deploy my website\non: push\n\njobs:\n  deploy:\n    runs-on: ubuntu-latest\n    steps:\n\n    # Put steps here to build your site, deploy it to a service, etc.\n\n    - name: Purge cache\n      uses: jakejarvis/cloudflare-purge-action@master\n      env:\n        # Zone is required by both authentication methods\n        CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE }}\n\n        CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}\n        # ...or:\n        CLOUDFLARE_EMAIL: ${{ secrets.CLOUDFLARE_EMAIL }}\n        CLOUDFLARE_KEY: ${{ secrets.CLOUDFLARE_KEY }}\n```\n\n### Purging specific files\n\nTo purge only specific files, you can pass an array of **fully qualified URLs** via a fourth environment variable named `PURGE_URLS`. Unfortunately, Cloudflare doesn't support wildcards (unless you're on the insanely expensive Enterprise plan) so in order to purge a folder, you'd need to list every file in that folder. It's probably safer to leave this out and purge everything, but in case you want really to, the syntax is as follows:\n\n```yaml\nPURGE_URLS: '[\"https://jarv.is/style.css\", \"https://jarv.is/favicon.ico\"]'\n```\n\n\n## License\n\nThis project is distributed under the [MIT license](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakejarvis%2Fcloudflare-purge-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjakejarvis%2Fcloudflare-purge-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakejarvis%2Fcloudflare-purge-action/lists"}