Git & GitHub Interview Question #101
What is a GitHub Actions environment?
Advanced GitHub Actions, Repository Internals, Submodules, LFS & Diagnostic Tools Senior Advanced
Quick Interview Answer
A GitHub Actions environment represents a deployment target such as development, staging, or production. Environments can be used to scope deployment configuration and apply protection rules before a job is allowed to access that environment.
Detailed Explanation
A GitHub Actions environment represents a deployment target such as development, staging, or production. Environments can be used to scope deployment configuration and apply protection rules before a job is allowed to access that environment.
For important deployments, environments can help separate production controls from ordinary CI. A workflow job declares the environment it targets, and repository configuration determines any required approvals or other restrictions.
Code Example
jobs:
deploy:
runs-on: ubuntu-latest
environment: production
steps:
- run: echo "Deploy to production"