2.2. Understanding Variable Substitution#
YAML itself cannot process or evaluate variables. However, many frameworks, such as in GitHub and GitLab allow the use of variables - environment variables - within YAML files
The Usage of
$
GitHub and GitLab use $
to reference variables in YAML files.
$<variable>
occurrences are substituted by the corresponding value prior to processing the YAML file.
Example
script:
- BRANCH=$CI_COMMIT_BRANCH
Note
GitHub also uses the ${{...}}
syntax that can evaluate expressions, like scoped variables.