Skip to content

Commit 69b8e6c

Browse files
authored
Merge pull request #43756 from github/repo-sync
Repo sync
2 parents 9a1f88b + f4ef935 commit 69b8e6c

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed
16.3 KB
Loading

content/actions/learn-github-actions/expressions.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,13 @@ Expressions are commonly used with the conditional `if` keyword in a workflow fi
2323
`${{ <expression> }}`
2424
{% endraw %}
2525

26-
{% data reusables.actions.expression-syntax-if %} For more information about `if` conditionals, see "[AUTOTITLE](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idif)."
26+
{% note %}
2727

28-
{% data reusables.actions.context-injection-warning %}
28+
**Note**: The exception to this rule is when you are using expressions in an `if` clause, where, optionally, you can usually omit {% raw %}`${{`{% endraw %} and {% raw %}`}}`{% endraw %}. For more information about `if` conditionals, see "[AUTOTITLE](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idif)."
2929

30-
### Example expression in an `if` conditional
30+
{% endnote %}
3131

32-
```yaml
33-
steps:
34-
- uses: actions/hello-world-javascript-action@e76147da8e5c81eaf017dede5645551d4b94427b
35-
if: <expression>
36-
```
32+
{% data reusables.actions.context-injection-warning %}
3733

3834
### Example setting an environment variable
3935

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
When you use expressions in an `if` conditional, you may omit the {% raw %}`${{ }}`{% endraw %} expression syntax because {% data variables.product.prodname_actions %} automatically evaluates the `if` conditional as an expression. However, this rule does not apply everywhere.
1+
When you use expressions in an `if` conditional, you can, optionally, omit the {% raw %}`${{ }}`{% endraw %} expression syntax because {% data variables.product.prodname_actions %} automatically evaluates the `if` conditional as an expression. However, this exception does not apply everywhere.
22

3-
You must use the {% raw %}`${{ }}`{% endraw %} expression syntax or escape with `''`, `""`, or `()` when the expression starts with `!`, since `!` is reserved notation in YAML format.
3+
You must always use the {% raw %}`${{ }}`{% endraw %} expression syntax or escape with `''`, `""`, or `()` when the expression starts with `!`, since `!` is reserved notation in YAML format. For example:
44

5-
Using the {% raw %}`${{ }}`{% endraw %} expression syntax turns the contents into a string, and strings are truthy. For example, `if: true && {% raw %}${{ false }}{% endraw %}` will evaluate to `true`.
5+
{% raw %}
6+
7+
```yaml
8+
if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
9+
```
10+
11+
{% endraw %}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
1. In the upper-right corner of any page, click {% octicon "bell" aria-label="You have (no) unread notifications" %}.
1+
1. In the upper-right corner of any page, click {% octicon "inbox" aria-label="You have (no) unread notifications" %}.
22

3-
![Screenshot of the right corner of the header of GitHub. A bell icon with a blue dot indicating unread notifications is outlined in dark orange.](/assets/images/help/notifications/notifications-general-existence-indicator.png)
3+
![Screenshot of the right corner of the header of GitHub. An inbox icon has a blue dot, indicating that there are unread notifications.](/assets/images/help/notifications/notifications-general-existence-indicator.png)

0 commit comments

Comments
 (0)