1
0
mirror of synced 2025-12-19 18:10:59 -05:00

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:
Y. Meyer-Norwood
2023-06-29 07:23:27 +12:00
committed by GitHub
parent 4aca5d210a
commit 5390942fd7
2 changed files with 13 additions and 2 deletions

View File

@@ -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:

View 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.