[DOCS]: What's the right way to pass JSON from one step to another? #227
Labels
Status: Up for grabs
Issues that are ready to be worked on by anyone
Type: Documentation
Improvements or additions to documentation
Type: Support
Any questions, information, or general needs around the SDK or GitHub APIs
Describe the need
I'm trying to parse the comments of issues, and label an issue if certain words are found. I'm using a query to get the comments of issues in the first step of my workflow, and a second step applies the label using the output.
The documentation for this action says that if I want to pass the output of a graphql query to another step, I should
but I can't figure out a way to do this that doesn't break in some way. Here's what I have currently:
What's the right way to pass the JSON output from the first step to the second step for handling? I'd really like just the first step's JSON output as an
Object
in the second step.Other stuff I've tried
JSON.parse(${{ steps.get_issue_text.outputs.data }})
fails because the argument is replaced with the literal output ofget_issue_text
, which isn't valid JS.JSON.parse(`${{ steps.get_issue_text.outputs.data }}`)
almost works, but will fail if there are newlines in the data, which aren't allowed in JSON, and will also fail if the data contains`
.${{ steps.get_issue_text.outputs.data }}
doesn't work; spaces aren't allowed"${{ steps.get_issue_text.outputs.data }}"
doesn't work because the GraphQL response contains"
, causing a syntax errorSDK Version
No response
API Version
No response
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: