act/pkg/runner/testdata/uses-composite/push.yml
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

44 lines
1.9 KiB
YAML
Executable file

name: uses-docker-url
on: push
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./uses-composite/composite_action
id: composite
with:
test_input_required: 'test_input_required_value'
test_input_optional: 'test_input_optional_value'
test_input_optional_with_default_overriden: 'test_input_optional_with_default_overriden'
test_input_required_with_default: 'test_input_optional_value'
test_input_required_with_default_overriden: 'test_input_required_with_default_overriden'
secret_input: ${{secrets.test_input_optional || 'NO SUCH SECRET'}}
env:
secret_input: ${{secrets.test_input_optional || 'NO SUCH SECRET'}}
- if: steps.composite.outputs.test_output != 'test_output_value'
run: |
echo "steps.composite.outputs.test_output=${{ steps.composite.outputs.test_output }}"
exit 1
- run: |
echo "steps.composite.outputs.secret_output=${{ steps.composite.outputs.secret_output }}"
[[ "${{steps.composite.outputs.secret_output == format('{0}/{0}', secrets.test_input_optional || 'NO SUCH SECRET')}}" = "true" ]] || exit 1
shell: bash
- run: |
echo "steps.composite.outputs.secret_output=$COMPOSITE_ACTION_ENV_OUTPUT"
[[ "${{env.COMPOSITE_ACTION_ENV_OUTPUT == 'my test value' }}" = "true" ]] || exit 1
shell: bash
# Now test again with default values
- uses: ./uses-composite/composite_action
id: composite2
with:
test_input_required: 'test_input_required_value'
test_input_optional_with_default_overriden: 'test_input_optional_with_default_overriden'
test_input_required_with_default_overriden: 'test_input_required_with_default_overriden'
- if: steps.composite2.outputs.test_output != 'test_output_value'
run: |
echo "steps.composite.outputs.test_output=${{ steps.composite2.outputs.test_output }}"
exit 1