Skip to content

ghostdevv/cloudflare-pages-cleanup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 to run this script and to clone/download this repo.

Step 1: Create a .env file, using the .env.example as an example.

cp .env.example .env
CLOUDFLARE_ACCOUNT_ID

You can find your Cloudflare account id in the URL bar, it'll look something like this:

url bar showing cloudflare account id

CLOUDFLARE_TOKEN

You need to create an api token that has permissions on your pages project. You can create that on the Cloudflare dashboard.

Select the "Edit Cloudflare Workers template"

cf dash api token

CLOUDFLARE_PAGES_PROJECT This is the name of your pages project which you set when you created it

Finally you can run the script

deno task run

About

Script to cleanup old Cloudflare Pages deployments

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

 
 
 

Contributors