What is the purpose of GitHub Actions environments, and what feature do they provide for deployment workflows?
Select an answer to reveal the explanation.
Short Explanation and Infographic
GitHub Actions environments are your deployment guardrails. Define environments like 'production' or 'staging,' set up required reviewers, and suddenly no workflow can deploy to prod without a human signing off. It's like a key-in-slot approval mechanism.
Full explanation below image
Full Explanation
GitHub Actions Environments are named deployment targets (e.g., production, staging, development) with specific protection rules. Environment features include: (1) Required reviewers — specific users or teams must approve before the job runs, (2) Wait timer — delays job execution by a specified time, (3) Deployment branches — restricts which branches can deploy to the environment, (4) Environment secrets — secrets scoped to the specific environment, not visible to other environments. When a workflow job references an environment with required reviewers, the workflow pauses and notifies the reviewers before proceeding. This enables controlled, auditable deployment workflows with manual approval gates for sensitive environments like production.