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.
More on Secrets, Variables, Environments & Permissions
Where can secrets be defined, and what is the precedence?BeginnerHow are secrets protected in transit and in logs, and what are the limits?IntermediateWhy is it a bad idea to store structured data like JSON or a whole `.env` file as one secret?IntermediateWhat is an environment, and which protection rules can it have?BeginnerWhen does a job wait for environment approval, and what does the reviewer see?IntermediateHow do deployment branch policies interact with tags and `workflow_dispatch`?Advanced