How do you restrict who can approve production deploys and stop someone approving their own change?
IntermediateConceptSecrets, Variables, Environments & Permissions
Answer
Set the prod environment's required reviewers to a team (platform-oncall), enable prevent self-review, restrict deployment branches to main and release tags, and disable admin bypass. Combine with branch protection on main (required reviews, CODEOWNERS on .github/workflows/) so the person cannot change the workflow to remove the environment line without review.
More on Secrets, Variables, Environments & Permissions
Where can secrets be defined, and what is the precedence?BeginnerHow are secrets protected in transit and in logs, and what are the limits?IntermediateAre secrets available to every step automatically?BeginnerWhy is it a bad idea to store structured data like JSON or a whole `.env` file as one secret?IntermediateWhat is an environment, and which protection rules can it have?BeginnerWhen does a job wait for environment approval, and what does the reviewer see?Intermediate