Skip to content
Latchkey

Scheduled deploy gating with environment approval in CI

A scheduled deploy that targets a protected environment will pause for the required reviewers, exactly like a manual deploy. If no one approves overnight, the nightly deploy sits "Waiting" instead of shipping.

What this error means

The nightly deploy job shows "Waiting" for an environment protection rule and never completes because no reviewer approves outside working hours.

GitHub Actions UI
Deployment to environment "production" is waiting for approval.
Required reviewers must approve before this job can proceed.

Common causes

Environment protection requires manual approval

A protected environment with required reviewers pauses any deploy, including scheduled ones, until someone approves.

No auto-approval path for cron

Scheduled runs cannot approve their own environment gate, so an overnight deploy stalls.

How to fix it

Use a separate auto-deployable environment for cron

  1. Point scheduled deploys at an environment without required reviewers, such as staging.
  2. Keep required reviewers only on interactive production deploys.
  3. Or add a wait timer instead of a human approval for cron.
.github/workflows/nightly.yml
jobs:
  nightly-deploy:
    environment: staging   # no required reviewers
    runs-on: ubuntu-latest

Gate with a wait timer, not a reviewer

If you want a delay but not a human, configure the environment with a wait timer so the scheduled deploy proceeds automatically after the timer.

How to prevent it

  • Do not target reviewer-gated environments from cron deploys.
  • Reserve manual approval for interactive deploys.
  • Use wait timers for automated delay without a human.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →