How do secrets and variables differ in GitHub Actions, and where can they be defined?
BeginnerConceptGitHub Actions
Answer
Secrets are encrypted values (${{ secrets.NAME }}) masked in logs; variables (${{ vars.NAME }}) are plain-text configuration. Both can be set at organisation, repository, or environment level, with the most specific scope winning. Secrets are not passed to workflows triggered by forked PRs, and reusable workflows only get them if passed explicitly or via secrets: inherit.
More on GitHub Actions
What are workflows, jobs, steps and actions in GitHub Actions?BeginnerWhat events can trigger a workflow?BeginnerWhat is the difference between `pull_request` and `pull_request_target`?AdvancedWhat is a runner, and how do GitHub-hosted and self-hosted runners differ?BeginnerHow do you pass data between steps and between jobs?IntermediateHow does a build matrix work?Intermediate