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

Where can secrets be defined, and what is the precedence?

BeginnerConceptSecrets, Variables, Environments & Permissions
Answer

Organization (optionally restricted to selected repos), repository, and environment. If the same name exists at several levels, the most specific wins: environment over repository over organization. Dependabot and Codespaces have their own separate secret stores. Secret names are case-insensitive, may only contain alphanumerics and underscores, and cannot start with GITHUB_.

gh secret set SLACK_WEBHOOK --body "$URL"
gh secret set DB_PASSWORD --env prod < pw.txt
gh secret set NPM_TOKEN --org devopsshack --repos shack-api,shack-web
All GitHub Actions questions Roadmap: GitHub Actions

More on Secrets, Variables, Environments & Permissions