Interview Prep/GitHub Actions/Secrets, OIDC & Environments

Staging and prod need different database URLs and different AWS roles, using one workflow. How?

BeginnerScenarioSecrets, OIDC & Environments
Answer

Situation read → Environment-scoped config.

What I'd do →

  1. Create environments staging and prod.
  2. Same names in each: secret DATABASE_URL, variable DEPLOY_ROLE_ARN.
  3. Job: environment: ${{ inputs.environment }} and reference secrets.DATABASE_URL, vars.DEPLOY_ROLE_ARN.

Why → Identical names keep the workflow generic; GitHub resolves values per environment.

Interview tip → Mention that prod secrets are only released after approval.

All GitHub Actions questions Roadmap: GitHub Actions

More on Secrets, OIDC & Environments