Protection rules and governance
The available protection rules
On an Environment's page (Settings > Environments > <name>):
- Required reviewers — up to 6 people/teams; a single approval unblocks the job.
- Wait timer — a delay in minutes before the job continues automatically, with no human action.
- Deployment branches and tags — restricts which branches/tags can reference this Environment (and therefore access its secrets).
- Prevent administrators from bypassing configured protection rules — disables the default admin bypass.
Hands-on step — configure a required reviewer and watch the block
- On the
demoEnvironment created in the previous module, enable Required reviewers and add yourself (or another account if you have one handy). - Go back to the Actions tab and re-run the
Environment demoworkflow (Run workflow). - This time, the run stays in Waiting status at the
say-hellojob — it doesn't run immediately. Open the run: a banner indicates a review is needed, with a Review deployments button. - Click it, select the Environment in question, approve. The job resumes and runs normally.
You just turned an automatic deployment into a governed one — without changing a single line of the workflow itself, only the configuration of the Environment it references.
Hands-on step — restrict deployment branches
- On the same
demoEnvironment, enable Deployment branches and tags and choose Selected branches and tags, allowing onlymain. - Create a
feature/test-envbranch and push a trivial change to it (a comment added to the workflow, for example). - From that branch, try to trigger the
Environment demoworkflow viaworkflow_dispatch, selectingfeature/test-envas the ref. - Observe: the job fails to start, with a message stating that the branch is not allowed to deploy to this Environment.
If you plan to reuse this demo Environment for something else afterward, remove the branch restriction and/or the required reviewer now — the following modules don't reuse them, but there's no reason to leave your repo more locked down than necessary without remembering it.
Why this governance matters
Without a protection rule, an Environment is just a namespace for secrets — useful for scoping (module 2), but with no guardrail. With required reviewers and a branch restriction, you get a real control gate: nobody deploys to production from an unvetted branch, or without a designated person explicitly approving it. This mechanism, more than secret scoping, is what justifies most of the value of Environments — and their real configuration cost (next module).
What you just did
You configured and observed, with real runs blocked then unblocked, the two most commonly used governance mechanisms: required human approval and branch restriction. The next module steps back to objectively weigh all of this against its complexity and real cost.
Check your understanding
How many people/teams can be designated as required reviewers on an Environment, and how many must approve to unblock the job?
What does an Environment's "wait timer" do?
A deployment branch policy restricting the `production` Environment to `main` only has been configured. A workflow triggered from a `feature/x` branch references `environment: production`. What happens?
Who can, by default, bypass an Environment's protection rules?
Want to hear about the next modules?
The Academy stays free and open-access, no sign-up required. If you'd just like to be notified by email when a new module ships, here you go — no obligation, unsubscribe anytime with one click.