Interview Prep/CI/CD/GitHub Actions

Deployments to production need a manual approval and only the main branch may deploy.

IntermediateScenarioGitHub Actions
Answer

Situation read → Environment protection rules.

What I'd do →

  1. Create a production environment with required reviewers and a deployment branch rule limited to main.
  2. Reference it: jobs.deploy.environment: production.
  3. Store prod secrets as environment secrets, so they are released only after approval.

Why → Secrets and approvals are enforced by the platform, not by workflow code a PR could change.

Interview tip → Note that environment secrets are not available to jobs that do not target that environment.

All CI/CD questions

More on GitHub Actions