Maven / GitHub Actions Interview Questions
What is the difference between the env:, secrets:, and vars: contexts in GitHub Actions?
All three hold key-value configuration but differ in storage location, security characteristics, and intended use.
| Context | Where it is defined | Encrypted at rest? | Visible in logs? | Typical use |
|---|---|---|---|---|
env: |
Inline in the workflow YAML (workflow/job/step scope) | No — plain text in the repo | Yes | Non-sensitive config like feature flags, version numbers, region names embedded directly in YAML |
secrets: |
Repository / Organisation / Environment Settings → Secrets | Yes — encrypted by GitHub | No — masked as *** |
Passwords, API keys, tokens, certificates — anything that must not be readable in the YAML or logs |
vars: |
Repository / Organisation / Environment Settings → Variables | No — stored as plain text | Yes | Non-sensitive config that should be managed in the GitHub UI without editing YAML (e.g. target environment URL, Node version to use across many workflows) |
The key distinction between env: and vars: is that vars: are managed in the GitHub UI and shared across workflows without touching YAML files, whereas env: values are hardcoded in the YAML itself. Use vars: when you want non-engineers to be able to change configuration without a pull request.
Access syntax: ${{ secrets.MY_KEY }}, ${{ vars.MY_VAR }}, ${{ env.MY_ENV }}.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
