зеркало из https://github.com/github/docs.git
Коммит
0643b90424
|
@ -52,6 +52,8 @@ As part of an expression, you can use `boolean`, `null`, `number`, or `string` d
|
||||||
| `number` | Any number format supported by JSON. |
|
| `number` | Any number format supported by JSON. |
|
||||||
| `string` | You don't need to enclose strings in `{% raw %}${{{% endraw %}` and `{% raw %}}}{% endraw %}`. However, if you do, you must use single quotes (`'`) around the string. To use a literal single quote, escape the literal single quote using an additional single quote (`''`). Wrapping with double quotes (`"`) will throw an error. |
|
| `string` | You don't need to enclose strings in `{% raw %}${{{% endraw %}` and `{% raw %}}}{% endraw %}`. However, if you do, you must use single quotes (`'`) around the string. To use a literal single quote, escape the literal single quote using an additional single quote (`''`). Wrapping with double quotes (`"`) will throw an error. |
|
||||||
|
|
||||||
|
Note that in conditionals, falsy values (`false`, `0`, `-0`, `""`, `''`, `null`) are coerced to `false` and truthy (`true` and other non-falsy values) are coerced to `true`.
|
||||||
|
|
||||||
### Example of literals
|
### Example of literals
|
||||||
|
|
||||||
{% raw %}
|
{% raw %}
|
||||||
|
@ -125,7 +127,7 @@ env:
|
||||||
{% endraw %}
|
{% endraw %}
|
||||||
|
|
||||||
In this example, we're using a ternary operator to set the value of the `MY_ENV_VAR` environment variable based on whether the {% data variables.product.prodname_dotcom %} reference is set to `refs/heads/main` or not. If it is, the variable is set to `value_for_main_branch`. Otherwise, it is set to `value_for_other_branches`.
|
In this example, we're using a ternary operator to set the value of the `MY_ENV_VAR` environment variable based on whether the {% data variables.product.prodname_dotcom %} reference is set to `refs/heads/main` or not. If it is, the variable is set to `value_for_main_branch`. Otherwise, it is set to `value_for_other_branches`.
|
||||||
It is important to note that the first value after the `&&` condition must be `truthy` otherwise the value after the `||` will always be returned.
|
It is important to note that the first value after the `&&` must be truthy. Otherwise, the value after the `||` will always be returned.
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче