How to Set a Wait Timer Before a Deploy in GitHub Actions
A wait timer on an environment holds every targeting deploy for a fixed number of minutes before it can proceed.
Enable the Wait timer protection rule on the environment and set the minutes. A job that targets the environment sits in a waiting state for that duration, giving you a window to cancel.
Steps
- Open the environment in Settings to Environments.
- Enable Wait timer and set the delay in minutes (up to 43200).
- Target the environment with
environment:; the run waits before deploying.
Workflow
.github/workflows/ci.yml
jobs:
deploy:
runs-on: ubuntu-latest
environment: production
steps:
- run: ./deploy.shGotchas
- The timer is a property of the environment, so it applies to every workflow that targets it.
- Cancelling the run during the wait stops the deploy without starting it.
Related guides
How to Gate Production Behind a Manual Approval in GitHub ActionsHold a GitHub Actions production deploy until a human approves it by targeting a protected environment with r…
How to Create a Deployment Environment in GitHub ActionsCreate a named deployment environment in GitHub Actions and target it from a job with the environment key, un…