How to auto delete old deployment

I would like to know, if there is some easy way, how to delete old deployment of project published on Vercel.
For example to have maximally 5 active deployment, and then when new deployment is successfully published, erase the oldest one existing.

Or of there is way, how to automise this process.

Currently during development of project, i am pushing often code to github, and vercel is automatically deploying it.
Clicking than every deployment and deleting it, is quite annoying.

It would be very helpful, to have select checkbox on each deployment (in project → deployments menu), and delete more deployments at same time.

Thank you for feedback, or any advice.

Hi, @daniel88dev! Welcome to the Vercel Community!

There is no built-in way to automatically limit or delete deployments in bulk right now. However, here are a few things that you can try:

  1. Use the Vercel CLI to remove multiple deployments at once. See relevant documentation. It’s faster than clicking through the dashboard:
vercel remove [deployment-url-1 deployment-url-2]
  1. You could create a script using Vercel’s API to automatically delete older deployments when you reach a certain number.
  2. To reduce deployments during development, consider using feature branches and only merging to main when features are complete. See relevant documentation. This way, you’ll trigger fewer automatic deployments.

Your idea about checkboxes for bulk deletion is great, I’ll pass it on internally :smile:

Let me know if you have follow-up questions!

1 Like

Hi again, @daniel88dev!

I just heard from our product team: what great timing on this post! :laughing:

We just shipped:

If you have any questions, let us know! I’ll mark this as the solution. :smiley:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.