Set up automatic revert for a failed deploy
Auto-revert watches the deploy your merge starts. If it fails, it opens and merges a revert pull request and tells you why. It is free for your first 10 releases, then part of Pro.
Step 1: say which workflows deploy
Open Settings, Repositories, Edit. Under Deploy to watch, tick the workflows that deploy to production, for example deploy.yml. If none is ticked, every run the merge starts is watched, so an unrelated workflow that fails (a lint or nightly job) would count as a failed deploy and could revert a good release. Always tick the deploy workflow.
Step 2: check the timeouts
The recommended values are filled in. You can change them (minutes):
- Deploy must start within: 1 to 30. If nothing starts in time you get a needs-attention email, not a revert.
- Deploy may take up to: 5 to 180.
- Wait for checks or another release up to: 0 to 240, 60 by default. It is how long a release waits for its checks to finish, or for another release on the same branch to finish merging and deploying. After that it is skipped and you are emailed.
Step 3: mark deploys that happen by hand
If some paths are deployed manually (for example a database migration), list them under Paths that deploy by hand. A pull request that touches them gets a warning, because an automatic revert cannot undo them.
What happens on a failure
- A failed run for the merge commit counts as a bad release.
- It reverts only while your merge is still the latest commit on the branch, so it never undoes other people’s work. If something newer landed, you get a needs-attention email.
- It opens a revert pull request, merges it, and watches the redeploy.
Requirement
The deploy must run from a workflow that starts on push. A deploy started by hand or by another system cannot be followed.
Background reading: How to automatically revert a failed deploy (and when not to) · Why your auto-rollback job can't push the revert to main · Why a merged pull request didn't start your deploy workflow
More guides: Add a health check URL to catch bad releases that deploy green · Schedule your first merge