{"id":17765432,"url":"https://github.com/patrickdappollonio/cloudflare-cache-purger","last_synced_at":"2025-03-15T12:30:22.398Z","repository":{"id":43152870,"uuid":"239391972","full_name":"patrickdappollonio/cloudflare-cache-purger","owner":"patrickdappollonio","description":"A tool to purge the cache of a domain in Cloudflare. Good to use with Github Actions, although it can run standalone.","archived":false,"fork":false,"pushed_at":"2023-03-24T06:33:43.000Z","size":23,"stargazers_count":4,"open_issues_count":5,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-27T02:54:10.810Z","etag":null,"topics":["cloudflare","cloudflare-cache","github-actions"],"latest_commit_sha":null,"homepage":"","language":"Go","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/patrickdappollonio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-09T23:41:27.000Z","updated_at":"2024-02-19T11:31:28.000Z","dependencies_parsed_at":"2024-06-20T18:51:39.915Z","dependency_job_id":null,"html_url":"https://github.com/patrickdappollonio/cloudflare-cache-purger","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickdappollonio%2Fcloudflare-cache-purger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickdappollonio%2Fcloudflare-cache-purger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickdappollonio%2Fcloudflare-cache-purger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickdappollonio%2Fcloudflare-cache-purger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/patrickdappollonio","download_url":"https://codeload.github.com/patrickdappollonio/cloudflare-cache-purger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243730789,"owners_count":20338717,"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":["cloudflare","cloudflare-cache","github-actions"],"created_at":"2024-10-26T20:13:04.766Z","updated_at":"2025-03-15T12:30:21.911Z","avatar_url":"https://github.com/patrickdappollonio.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cloudflare cache purger\n\nThis is a simple Go app that deletes the Cloudflare cache for a specific domain.\nIt does so by using the Cloudflare API, authenticating using a properly set\ntoken and the ID of the zone you want to clear.\n\n## Setup\n\nIn Cloudflare, visit the [API Tokens](https://dash.cloudflare.com/profile/api-tokens)\nsection and click in the \"Create Token\" button. There, define the following:\n\n* *Name:* Define a name for your token. Use something you would remember, like\n    `cache-purger` or similar.\n* *Permissions:* In the dropdown for \"Account\" select \"Zone\". Then, the next\n    dropdown right next to \"Zone\", select \"Cache Purge\", and finally, on the\n    last dropdown select \"Purge\". This will allow the token only to Purge Caches\n    on Zones. If the token happens to be leaked, the worst thing an attacker\n    could do is simply delete your cache.\n* *Zones:* Here you need to decide: do you want the token to be used on all\n    zones across your account? If you have 7 domains, it might be a bit\n    cumbersome having to authenticate against all of them with different tokens.\n    If this is still what you want to do, you can mix and match this setting:\n    you can include all zones, include a few zones, exclude all zones (no idea\n    why would you do that lol) or simply exclude selected zones.\n\nOnce the form is completed, submit it by clicking on \"Continue to Summary\".\nYou'll see a list of your selections here, which you can use to validate if the\nconfiguration is correct. Click on \"Create Token\" if you're ready, or \"Cancel\"\nto start over.\n\nAdditionally, you'll need the ID of the Zone on which you want to clear the\ncache. This is a bit easy to get, simply select your domain from the list of\ndomains in the homepage (you can click the Cloudflare logo to access it directly)\nthen on the right side of the screen you'll see an \"API\" section with two IDs:\nthe Zone ID and the Account ID. We only need the \"Zone ID\", so grab it and keep\nit somewhere for the setup.\n\n## Usage\n\nGrab one of the binaries from the [releases page](https://github.com/patrickdappollonio/cloudflare-cache-purger/releases)\nand put it somewhere in your `$PATH` (or the equivalent in Windows).\nAdditionally, you can use the Docker image released at\n`patrickdappollonio/cloudflare-cache-purger`.\n\nIn both cases, configuration is provided via environment variables:\n\n* `TOKEN` or `INPUT_TOKEN`: The token you got following the [Setup step](#setup)\n* `ZONE` or `INPUT_ZONE`: The Zone ID from the [Setup step](#setup)\n\nWhile `TOKEN` and `ZONE` are the recommended, the environment variables starting\nwith `INPUT_` are there for compatibility and ease of use with Github Actions.\n\nFor use with Docker, simply run the container, passing the environment variables\nrequired:\n\n```bash\ndocker run -e=\"TOKEN=my-token\" -e=\"ZONE=my-zone\" patrickdappollonio/cloudflare-cache-purger\n```\n\n## Github Actions\n\nYou can use this project with Github actions, and as an added benefit, you'll\navoid having to pay the penalty of building the container, since it's already\npublished. The code for the step is:\n\n```yaml\njobs:\n  clear-cache:\n    steps:\n      - name: Compile and release for Windows amd64\n        uses: docker://patrickdappollonio/cloudflare-cache-purger:v1.0.0\n        with:\n          token: ${{ secrets.CLOUDFLARE_TOKEN }}\n          zone: ${{ secrets.CLOUDFLARE_ZONE }}\n```\n\nDon't forge to specify both `CLOUDFLARE_TOKEN` and `CLOUDFLARE_ZONE` as secrets\nin your repository.\n\n## Debugging\n\nThe application includes a quick-and-dirty debugging mode which shouldn't be\nused in public environments, since it spills out both requests and responses,\nwhich will contain your secrets such as tokens or zones. Enable the debug mode\nby setting the environment variable `DEBUG` to any value.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickdappollonio%2Fcloudflare-cache-purger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatrickdappollonio%2Fcloudflare-cache-purger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickdappollonio%2Fcloudflare-cache-purger/lists"}