https://github.com/ghostdevv/cloudflare-pages-cleanup
https://github.com/ghostdevv/cloudflare-pages-cleanup
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ghostdevv/cloudflare-pages-cleanup
- Owner: ghostdevv
- License: mit
- Created: 2024-04-13T01:56:49.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-13T02:07:44.000Z (almost 2 years ago)
- Last Synced: 2025-02-08T15:46:41.053Z (about 1 year ago)
- Language: TypeScript
- Size: 59.6 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cloudflare Pages Cleanup
Old deployments in pages are not always a problem, but can be (for example) if your deployment URLs are public and you make a security fix. This script when ran will delete deployments older than two weeks.
## Running
You'll need [Deno](https://docs.deno.com/runtime/manual) to run this script and to clone/download this repo.
Step 1: Create a `.env` file, using the `.env.example` as an example.
```bash
cp .env.example .env
```
CLOUDFLARE_ACCOUNT_ID
You can find your Cloudflare account id in the URL bar, it'll look something like this:

CLOUDFLARE_TOKEN
You need to create an api token that has permissions on your pages project. You can create that on the [Cloudflare dashboard](https://dash.cloudflare.com/profile/api-tokens).
Select the "Edit Cloudflare Workers template"

CLOUDFLARE_PAGES_PROJECT
This is the name of your pages project which you set when you created it
Finally you can run the script
```bash
deno task run
```