Interview Prep/GitHub Actions/Secrets, Variables, Environments & Permissions

Are secrets available to every step automatically?

BeginnerConceptSecrets, Variables, Environments & Permissions
Answer

No. A secret only reaches a step if you reference it, via env or with:

- run: ./notify.sh
  env:
    SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

Scope it to the narrowest step that needs it, not workflow-level env, so that third-party actions in other steps never see it. Reusable workflows also get no caller secrets unless passed explicitly or with secrets: inherit.

All GitHub Actions questions Roadmap: GitHub Actions

More on Secrets, Variables, Environments & Permissions