Interview Prep/GitHub Actions/Contexts, Expressions, Env & Outputs

How do you use `vars` and what is the precedence between levels?

BeginnerConceptContexts, Expressions, Env & Outputs
Answer

Configuration variables are plain-text values set at organization, repository and environment level, read with ${{ vars.NAME }}. Precedence: environment over repository over organization. They are not masked in logs and should be considered readable by anyone who can see the workflow output. Use them for region names, account IDs, cluster names and feature flags; never for credentials.

gh variable set AWS_REGION --body ap-south-1
gh variable set CLUSTER_NAME --env prod --body shack-prod
All GitHub Actions questions Roadmap: GitHub Actions

More on Contexts, Expressions, Env & Outputs