mirror of
https://github.com/nektos/act.git
synced 2026-04-26 09:25:54 +03:00
[GH-ISSUE #5972] Conditional steps using expressions with variables always evaluate to 'true' #1307
Labels
No labels
area/action
area/cli
area/docs
area/image
area/runner
area/workflow
backlog
confirmed/not-planned
kind/bug
kind/discussion
kind/external
kind/feature-request
kind/question
meta/duplicate
meta/invalid
meta/need-more-info
meta/resolved
meta/wontfix
meta/workaround
needs-work
pull-request
review/not-planned
size/M
size/XL
size/XXL
stale
stale-exempt
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/act#1307
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mfncooper on GitHub (Nov 21, 2025).
Original GitHub issue: https://github.com/nektos/act/issues/5972
Bug report info
Command used with act
Describe issue
When using a variable in the expression for a conditional step, the expression evaluation is broken, and the condition always evaluates to
true. For example, in the workflow below, this condition should always befalse, since the job name islocal-test-job, which obviously does not containfoo:However, it always evaluates to
true(or at least an expression that is treated astrue). The expression evaluation process retrieves the correct value from the variable, as seen in the log, but then it does not finish formatting the result and evaluating the expression. It seems as if it stops short of one more required evaluation step.Evaluation using
contains()with hardcoded values works correctly, so it is the use of variables that is causing the issue. The log output for hardcoded expressions, both successful and not, are included below.This problem is not specific to the use of
github.job. I need to be able to use it with, for example,matrix.config.name, but that exhibits the same issue. That's consistent with the value of the variable being retrieved correctly but the remainder of the evaluation not being properly completed.The problem is also not Windows-specific. I ran the same workflow with
ubuntu-latestand an appropriately adjusted command line (i.e. without the-Ppiece), and saw the same result.Link to GitHub repository
No response
Workflow content
Relevant log output
Additional information
No response
@ChristopherHX commented on GitHub (Nov 22, 2025):
Isn't this exactly what happens if you do this on GitHub Actions?
Never include
${{}}in the middle of action if conditions. You do not need them to access variables inside an condition.@ChristopherHX commented on GitHub (Nov 22, 2025):
Well act could literally reject your workflow, but then someone might complain why does it not run while this works fine on GitHub Actions
@mfncooper commented on GitHub (Nov 23, 2025):
I completely missed, in the rather incomplete GitHub Docs, that it's the entire expression that goes between
${{and}}, and not just the variable name, and that you can also omit them entirely. Sorry for the noise.