Encrypted Secrets¶
Secrets are encrypted environment variables that you create in an organization, repository, or repository environment. The secrets that you create are available to use in your GitHub Actions workflows. This is the correct place to store tokens, passwords, and private keys.
Creating Secrets¶
- On GitHub.com, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the "Security" section of the sidebar, select Secrets and variables, then click Actions.
- Click New repository secret.
- Type a name for your secret in the Name input box.
- Enter the value for your secret.
- Click Add secret.
Example Workflow¶
Secrets are accessed using the secrets context.
steps:
- name: Hello world
run: echo Hello World
env:
SUPER_SECRET: ${{ secrets.SuperSecret }}
Usage Limits¶
- Secrets are automatically redacted from logs.
- You cannot read secrets in a workflow triggered by a
pull_requestfrom a fork.
📬 DevopsPilot Weekly — Learn DevOps, Cloud & Gen AI the simple way.
👉 Subscribe here