> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.

# Delete Deployments for Deleted Branches

When you delete a GitHub branch, you can automatically delete the Vercel [Deployment](https://vercel.com/docs/glossary#deployment) associated with that branch.

This feature is enabled only when the event is `delete` and `cleanup-deployment` is set to `true`.

Create the following workflow in `.github/workflows/cleanup-deployments.yml` in your repository.

```yaml file="/snippets/cleanup-workflow.yml"
name: Cleanup Vercel deployments

on:
  delete:

jobs:
  cleanup:
    if: ${{ github.event.ref_type == 'branch' }}
    name: Cleanup deployments
    runs-on: ubuntu-latest

    steps:
      - uses: nexterias/actions-vercel@v2
        with:
          token: ${{ secrets.VERCEL_TOKEN }}
          org-id: ${{ secrets.VERCEL_ORG_ID }}
          project-id: ${{ secrets.VERCEL_PROJECT_ID }}
          cleanup-deployment: true

```

Place this workflow file on your repository's default branch.

## Deployments to Be Deleted

- Deletes Deployments associated with the deleted GitHub branch from the specified Vercel Project.
- Does not delete [Production Deployments](https://vercel.com/docs/glossary#production-deployment).
- This workflow does not run when a tag is deleted.
