act/pkg/exprparser
Björn Brauer c24cfc72f4
Expression evaluator fixes (#1009)
* refactor: remove debug error output

Errors should always be logged with an error level and not debug level.
Since the error is returned here, it will be logged later as an error.
Presumably this was a leftover from debugging the executor chain in:
PR: #971

* refactor: debug log wich expression is going to be evaluated

* fix: handle nil in EvalBool

We've seen this issue when the env map is not set-up properly,
i.e. when the env map is nil, EvalBool might return nil, which should
be handled as a falsy value.

* fix: fail on error in if expression and return the evaluation error

Stop running the workflow in case an expression cannot be evaluated.

Fixes: #1008

* fix: remove quotes from inside expression syntax in test

It looks like having an expression inside double quotes inside the
expression syntax is not valid: https://github.com/ZauberNerd/act-test/actions/runs/1881986429
The workflow is not valid. .github/workflows/test.yml (Line: 10, Col: 13): Unexpected symbol: '"endsWith'. Located at position 1 within expression: "endsWith('Hello world', 'ld')"

* refactor: export IsTruthy function from exprparser package

* refactor: use IsTruthy function in EvalBool

* refactor: move debug log for expression rewrite to rewrite function

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-02-25 18:39:50 +00:00
..
testdata Refactor expression evaluator to use parser from actionlint package (#908) 2022-01-21 08:07:20 -08:00
functions.go Refactor expression evaluator to use parser from actionlint package (#908) 2022-01-21 08:07:20 -08:00
functions_test.go Refactor expression evaluator to use parser from actionlint package (#908) 2022-01-21 08:07:20 -08:00
interpreter.go Expression evaluator fixes (#1009) 2022-02-25 18:39:50 +00:00
interpreter_test.go Refactor expression evaluator to use parser from actionlint package (#908) 2022-01-21 08:07:20 -08:00