[GH-ISSUE #1746] Expressions interpreter doesn't support short circuit for && and || #853

Closed
opened 2026-03-01 21:46:54 +03:00 by kerem · 2 comments
Owner

Originally created by @ChristopherHX on GitHub (Apr 20, 2023).
Original GitHub issue: https://github.com/nektos/act/issues/1746

github.com/nektos/act@3715266494/pkg/exprparser/interpreter.go (L546-L558)

on: push
jobs:
  _:
    runs-on: ubuntu-latest
    if: always() && (contains(needs.*.result, 'cancelled') && fromjson('throw') || !cancelled())
    steps:
    - run: echo "Never reach here"

fromjson('throw') should be unreachable if no job has result cancelled, but it still get executed.

I will pick this up at some point of time

Originally created by @ChristopherHX on GitHub (Apr 20, 2023). Original GitHub issue: https://github.com/nektos/act/issues/1746 https://github.com/nektos/act/blob/37152664940eea09a6775daf5eff8ee0d7f31442/pkg/exprparser/interpreter.go#L546-L558 ```yaml on: push jobs: _: runs-on: ubuntu-latest if: always() && (contains(needs.*.result, 'cancelled') && fromjson('throw') || !cancelled()) steps: - run: echo "Never reach here" ``` `fromjson('throw')` should be unreachable if no job has result `cancelled`, but it still get executed. _I will pick this up at some point of time_
kerem 2026-03-01 21:46:54 +03:00
  • closed this issue
  • added the
    kind/bug
    label
Author
Owner

@officel commented on GitHub (May 27, 2023):

I have this problem.
The steps I don't want to be executed are being executed and I would be happy if you could solve it.

<!-- gh-comment-id:1565686849 --> @officel commented on GitHub (May 27, 2023): I have this problem. The steps I don't want to be executed are being executed and I would be happy if you could solve it.
Author
Owner

@ChristopherHX commented on GitHub (May 28, 2023):

I'm not shure you have the same issue, I thought steps are skipped in this case.

Should be fixed by backporting github.com/ChristopherHX/act@b973a14dd0 from my fork

<!-- gh-comment-id:1566145699 --> @ChristopherHX commented on GitHub (May 28, 2023): I'm not shure you have the same issue, I thought steps are skipped in this case. Should be fixed by backporting https://github.com/ChristopherHX/act/commit/b973a14dd0d569a4704647981539563f948367dd from my fork
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#853
No description provided.