To ensure there can always be an active deployment, you can only delete an inactive deployment. Anyone with repo or repo_deployment scopes can delete an inactive deployment.To set a deployment as inactive, you must:
Create a new deployment that is active so that the system has a record of the current state, then delete the previously active deployment.
Mark the active deployment as inactive by adding any non-successful deployment status.