Skip to content

jamaluddinrumi/delete-all-deployments

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deletes all deployments given a Pages project name

How to

1. Install dependencies

bun install

2. Delete all deployments except for the live production deployment (excluding aliased deployments)

# .env

CF_API_TOKEN=xxx
CF_ACCOUNT_ID=xxx

# Delete all deployments except for the live production deployment
# (INCLUDING aliased deployments, eg. my-branch.exampleproj.pages.dev)
# CF_DELETE_ALIASED_DEPLOYMENTS=true

3. run start script

bun run start <project-name>

How it works

This script uses the Cloudflare API to list all deployments for a given Pages project, then deletes all but the live production deployment.

It uses exponential-backoff to retry failed requests.