mirror of
https://github.com/nektos/act.git
synced 2026-04-26 01:15:51 +03:00
[GH-ISSUE #1481] Error evaluating valid JSON with withJSON expression #762
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#762
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 @20k-ultra on GitHub (Nov 29, 2022).
Original GitHub issue: https://github.com/nektos/act/issues/1481
Bug report info
Command used with act
Describe issue
I have noticed so far for 2 places in workflows that, when you are using
fromJSONexpression, act will say the valid is not valid JSON.When running a workflow which sets
runs-onwith something that uses thefromJSONexpression, an error is thrown regardless of what the value passed tofromJSONis. If I remove thefromJSONexpression and reference the value directly, it works.The 2nd place I've noticed this same behaviour is when using
fromJSONfor a matrix.Link to GitHub repository
No response
Workflow content
Relevant log output
Additional information
Using the following command to control an input:
with this workflow file:
https://docs.github.com/en/actions/learn-github-actions/expressions#fromjson
@KnisterPeter commented on GitHub (Nov 29, 2022):
The characters
ubuntu-latestare no valid JSON. The string"ubuntu-latest"would be.@20k-ultra commented on GitHub (Nov 29, 2022):
Thanks for fast response @KnisterPeter, you're correct that my initial command contained invalid JSON. Once I added the quotes act ran the workflow correctly.
However, when I set the same environment variable in an env-file I get the invalid json error...am I doing something wrong again ?
@20k-ultra commented on GitHub (Nov 29, 2022):
Sorry for the ping. To escape the
"in the env file you just have to use single'around the double quotes...works^
@mcascone commented on GitHub (Apr 24, 2025):
But the non-quoted syntax works without issue on a real GitHub runner.I was wrong here. My error was due to unknowingly passing empty strings to the
fromJSONfunction.When testing in
act, I was runningworkflow_callreusable workflows directly. Based on this conversation, I created a kicker-offer workflow with apushtrigger that calls the reusable workflow - and everything seems to flow correctly now!