Re-structure env-variables to correct format for JSON #26854
-
Hi all, I’m fairly new in coding. Anyway, I am trying to compare two branches and get the JIRA Tickets or JIRA Keys between those two branches whenever a pull request is made and I have already set as env-variable. However, whenever I pass it’s value to JSON, it isn’t correctly formatted. Is this possible? Please see the sample below.
The value that was retrieved is like this:
instead of like this:
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
When you use
I like Python, so I’d use something like this:
Well, I’d probably integrate that with parsing the |
Beta Was this translation helpful? Give feedback.
-
Thanks! This works very well. I’m thinking of investing time on Python more as well. :slight_smile: Have a great day! |
Beta Was this translation helpful? Give feedback.
-
Jira is an incredibly powerful tool for developers and testers alike. It's easy to create tracking algorithms and code in it. The possibilities are endless regarding what you can do with Jira. |
Beta Was this translation helpful? Give feedback.
When you use
${{ env.Tickets }}
what happens is a simple string substitution, the literal value of theTickets
environment variable is placed at the location. If you want it contain a JSON structure you’ll have to create that yourself. Note that to get a valid JSON array of issues yourjson
field should look like this:I like Python, so I’d use something like this:
Well, I’d probably integrate that with parsing the
git log
output, but I think the idea is visible.