Add explanation of ordinal comparison of strings using the < and > operators (#25870)
Co-authored-by: Courtney Wilson <77312589+cmwilson21@users.noreply.github.com> Co-authored-by: Joe Clark <31087804+jc-clark@users.noreply.github.com>
This commit is contained in:
@@ -17,7 +17,7 @@ You can use expressions to programmatically set environment variables in workflo
|
||||
|
||||
Expressions are commonly used with the conditional `if` keyword in a workflow file to determine whether a step should run. When an `if` conditional is `true`, the step will run.
|
||||
|
||||
You need to use specific syntax to tell {% data variables.product.prodname_dotcom %} to evaluate an expression rather than treat it as a string.
|
||||
{% data reusables.actions.expressions-syntax-evaluation %}
|
||||
|
||||
{% raw %}
|
||||
`${{ <expression> }}`
|
||||
@@ -80,7 +80,7 @@ env:
|
||||
| Operator | Description |
|
||||
| --- | --- |
|
||||
| `( )` | Logical grouping |
|
||||
| `[ ]` | Index
|
||||
| `[ ]` | Index |
|
||||
| `.` | Property de-reference |
|
||||
| `!` | Not |
|
||||
| `<` | Less than |
|
||||
@@ -92,6 +92,16 @@ env:
|
||||
| `&&` | And |
|
||||
| <code>\|\|</code> | Or |
|
||||
|
||||
{% note %}
|
||||
|
||||
**Notes:**
|
||||
- {% data variables.product.company_short %} ignores case when comparing strings.
|
||||
- `steps.<step_id>.outputs.<output_name>` evaluates as a string. {% data reusables.actions.expressions-syntax-evaluation %} For more information, see "[AUTOTITLE](/actions/learn-github-actions/contexts#steps-context)."
|
||||
- {% data reusables.actions.expression-syntax-if %} For more information about `if` conditionals, see "[AUTOTITLE](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idif)."
|
||||
- For numerical comparison, the `fromJSON()` function can be used to convert a string to a number. For more information on the `fromJSON()` function, see "[fromJSON](#fromjson)."
|
||||
|
||||
{% endnote %}
|
||||
|
||||
{% data variables.product.prodname_dotcom %} performs loose equality comparisons.
|
||||
|
||||
- If the types do not match, {% data variables.product.prodname_dotcom %} coerces the type to a number. {% data variables.product.prodname_dotcom %} casts data types to a number using these conversions:
|
||||
|
||||
1
data/reusables/actions/expressions-syntax-evaluation.md
Normal file
1
data/reusables/actions/expressions-syntax-evaluation.md
Normal file
@@ -0,0 +1 @@
|
||||
You need to use specific syntax to tell {% data variables.product.prodname_dotcom %} to evaluate an expression rather than treat it as a string.
|
||||
Reference in New Issue
Block a user