Loop through the output of fromJSON #44026
Replies: 3 comments
-
|
This looks to me like a job for jq. You can use it on the stringified JSON output from the meta step, like - run: echo '${{ steps.meta.outputs.json }}' | jq '.tags[]'jq is a powerful command line tool for querying JSON. There's a lot more you could do with it here, if you wanted. You could, for example, extract just the tags, separate from the registry and image name. jq manual here https://stedolan.github.io/jq/manual/ |
Beta Was this translation helpful? Give feedback.
-
|
Using |
Beta Was this translation helpful? Give feedback.
-
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Github Action
Question
Body
I am using docker/metada-action. How should I access all the items in the tags array?
I can able to access the first item like
"${{fromJSON(steps.meta.outputs.json).tags[0]}}"but could not find a way to access all items in the array.I tried numerous ways like the below and also but did not work.
fromJSON(steps.meta.outputs.json).tags['*'],fromJSON(steps.meta.outputs.json).tags[@]What is the best way of achieving this?
Here is the output
Beta Was this translation helpful? Give feedback.
All reactions