AI Hints
Home›CI/CD with GitHub Actions Tutorial›Environments and Approvals
CI/CD with GitHub Actions · Lesson 86 of 138

Approvals

A human says go.

⏱ 2 min read▶ Video at 1:39:26🎓 Free
Watch this lesson in the CI/CD with GitHub Actions courseWatch on YouTube ↗Full CI/CD with GitHub Actions course

Continuous delivery means production could be deployed at any moment. But many teams want a person to press go. With required reviewers on the production environment, the workflow pauses and waits.

Approvals
From the video: Approvals
  • Ready at any moment
  • A person presses go
  • The workflow waits

How an approval works

The staging job finishes. The production job starts, sees the protection rule, and pauses. GitHub notifies the reviewers. One of them checks staging, and clicks approve. Then the production job carries on and deploys.

  1. Staging done
  2. Production waits
  3. Reviewers notified
  4. Approved
  5. Deploy
How an approval works
From the video: How an approval works

Protection rules

Required reviewers lists who can approve, up to six people or teams. A wait timer adds a delay, like ten minutes, to watch staging first. Prevent self review stops the person who pushed from approving their own deploy. And deployment branches limit which branches can deploy at all.

keyvalue
Required reviewerswho can approve
Wait timerdelay in minutes
No self-reviewanother person
Branchesonly main

Approvals in practice

Approvals work best when reviewers know what to check. Link the staging URL in the environment, so they can try the change. Keep the approval quick, because a deploy waiting for hours blocks everyone. And remember, approvals add safety, but good tests and monitoring add more.

keyvalue
Staging URLtry before approving
Be quickdon't block the team
Small changeseasy to approve
Tests + monitoringthe real safety

Summary

Required reviewers pause a deployment until someone approves. Next, secrets that belong to one environment.

Key takeaways
  • Reviewers
  • Wait timers
  • Branch rules
Next up: Environment Secrets — different keys per stage