2.4.5. How to Define Variables#
GitHub allows the use of variables in Workflows definitions and provides a variety of context variables that can be accessed using the ${{...}} syntax.
Some important contextual variables include:
github: Provides metadata about the Workflow run, Repository, and event that triggered the Workflow, etc.E.g.
github.event_nameindicates the name of the event that triggered the Workflow (e.g.push,pull_request, etc.) whilegithub.repositoryprovides the name of the Repository.
vars: Contains variables defined at the Repository, Organization or Environment level. These variables can be set via the Web-UI.For instance,
vars.my_variablerepresents a variable namedmy_variable.
Warning
Sensitive data should be stored outside of GitHub!
secrets is the only half-way acceptable place to store sensitive data!
secrets: contains the names and values of secrets defined for the Repository, Organization or Environment. Secrets are handled in a specific way by GitHub and can be set via the Web-UI.For example,
secrets.TOKENrefers to a secret namedTOKEN.