mirror of
https://github.com/nektos/act.git
synced 2026-04-26 09:25:54 +03:00
[GH-ISSUE #718] Issue: act allows ternary operator in expression #455
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#455
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 @notmatthancock on GitHub (Jun 3, 2021).
Original GitHub issue: https://github.com/nektos/act/issues/718
Act version
Expected behaviour
actshouldn't allow ternary operator syntax inside of an expressionReference: https://github.community/t/do-expressions-support-ternary-operators-to-change-their-returned-value/18114
Actual behaviour
actdoes allow ternary operator syntax inside of an expression, and it fails when run as a github actionWorkflow and/or repository
workflow
Steps to reproduce
actoutputLog
@notmatthancock commented on GitHub (Jun 3, 2021):
I'm not sure if this is a broader problem besides just the ternary operator. Github has some mini domain language for contexts/expressions, and I was not able to find documentation that describes if their expression DSL is a known language or not. I'm curious what
actuses for evaluating expressions.@ChristopherHX commented on GitHub (Jun 3, 2021):
I would say it's a broader problem
The ternary operator can be rewritten to
${{runner.os == 'linux' && 'Yes' || 'No'}}in dtexpressions2 similar to js.Other examples
Not working in act
${{contains(github.event.commits.*.message, 'Test')}}${{'${{This is a string with an escaped expression }}'}}Not working with dtexpressions
${{3+5}}${{"Double quotes"}}...
@notmatthancock commented on GitHub (Jun 3, 2021):
Interesting, I have not heard of this. A google search returns 0 results for "DTExpressions2". Any links? I'd be curious to read more.
I see. So perhaps a resolution of this issue could be documenting the discrepancy in the Known issues section of the README.
@ChristopherHX commented on GitHub (Jun 3, 2021):
DTExpressions2 is an internal azure pipelines product, which was (accidentally?) open sourced under the MIT License.
Documentation of some parts of the language: https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions
The source code can be found here
I agree the documentation isn't really great for this language. I took the name out of the soucecode, DT = DistributedTasks.
Azure pipelines still uses version 1 of this language,
I use this in my act clone for full compatibility with github. You could try this if you really need the same expression interpreter
@github-actions[bot] commented on GitHub (Jul 4, 2021):
Issue is stale and will be closed in 14 days unless there is new activity
@ZauberNerd commented on GitHub (Feb 1, 2022):
This has been fixed with: https://github.com/nektos/act/pull/908 and will be released with the next version.
If you want to try it out earlier, use one of the snapshots: https://github.com/nektos/act/actions/runs/1653750680 or install / build from master: https://github.com/nektos/act#go-linuxwindowsmacosany-other-platform-supported-by-go https://github.com/nektos/act#manually-building-from-source