[GH-ISSUE #482] if: syntax without ${{ }} seems to always evaluate to false, even if invalid #332

Closed
opened 2026-03-01 21:42:26 +03:00 by kerem · 1 comment
Owner

Originally created by @edtan on GitHub (Jan 17, 2021).
Original GitHub issue: https://github.com/nektos/act/issues/482

This issue is similar to #366, but in this case, it appears that if statements without ${{ }} are not evaluated, and always return false. This sample workflow illustrates the issue:

name: "Test if statements"
on: push

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
     - name: "bad expression, but act does not evaluate it and skips this step"
       if: foobar1
       run: echo "This does not run"

     - name: "bad expression, and act evaluates it and detects a bad expression "
       if: ${{ foobar2 }}
       run: echo "act will error before reaching this part"

For the second step, the logs show:

ERRO[0000] Unable to interpolate string '${{ foobar2 }}' - [ReferenceError: 'foobar2' is not defined]

This was tested on v0.2.18.

Originally created by @edtan on GitHub (Jan 17, 2021). Original GitHub issue: https://github.com/nektos/act/issues/482 This issue is similar to #366, but in this case, it appears that `if` statements without `${{ }}` are not evaluated, and always return `false`. This sample workflow illustrates the issue: ``` name: "Test if statements" on: push jobs: test: runs-on: ubuntu-latest steps: - name: "bad expression, but act does not evaluate it and skips this step" if: foobar1 run: echo "This does not run" - name: "bad expression, and act evaluates it and detects a bad expression " if: ${{ foobar2 }} run: echo "act will error before reaching this part" ``` For the second step, the logs show: ``` ERRO[0000] Unable to interpolate string '${{ foobar2 }}' - [ReferenceError: 'foobar2' is not defined] ``` This was tested on `v0.2.18`.
kerem closed this issue 2026-03-01 21:42:26 +03:00
Author
Owner

@edtan commented on GitHub (Jan 17, 2021):

Seems like changing return false, nil to return false, err will surface the error: github.com/nektos/act@e6fcfed458/pkg/runner/run_context.go (L315-L318)

<!-- gh-comment-id:761860989 --> @edtan commented on GitHub (Jan 17, 2021): Seems like changing `return false, nil` to `return false, err` will surface the error: https://github.com/nektos/act/blob/e6fcfed458dbccd640e093bffd0fc258d6ce0e6e/pkg/runner/run_context.go#L315-L318
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#332
No description provided.