From bd93ff39b6ef2c9e8605b7c4009079b5f6486928 Mon Sep 17 00:00:00 2001 From: dmvict Date: Tue, 19 Nov 2024 15:59:39 +0200 Subject: [PATCH] Update file `Readme`, add info about complex expressions --- Readme.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Readme.md b/Readme.md index b77dd87d..b62a5f1e 100644 --- a/Readme.md +++ b/Readme.md @@ -134,6 +134,29 @@ Example of condition with check of current step output: option2: value ``` +**How to use complex conditions** + +The library used for evaluating expressions does not account for operator precedence, which can lead to incorrect results in complex expressions where the order of operations is crucial. + +Example of the issue. Consider the following expression: +```yaml + 'main' == 'main' && 'main' != 'master' +``` + +Due to the library's evaluation method, this expression is interpreted as: +```yaml + (('main' == 'main') && 'main') != 'master' +``` + +As a result, it evaluates to `false`, which is not the intended outcome. + +To ensure that the expression is evaluated correctly, you can use parentheses to explicitly define the order of operations. The corrected expression should be written as: +```yaml + ('main' == 'main') && ('main' != 'master') +``` + +This adjustment clarifies the intended precedence and will yield the correct result. + ### `github_token` A token to access private actions. Does not required for public actions.