Skip to content
Discussion options

You must be logged in to vote

That's because you run the variable through the shell without escaping in the echo command. The shell then interprets the " as shell syntax, and in the end it's gone from the output.

For the job that creates the output, you could simply use the set-output command directly from Python, so it doesn't go through the shell:

import json
# set output_list somehow
print(f'::set-output name=test::{json.dumps(output_list)}')

And you even get a simpler workflow as a bonus. 😸

For the receiving job it depends what you actually want to do with it. If you need to insert it directly into a shell command (and not via env or something), you could even run the JSON through shlex.quote() before writing it t…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@sr1dar
Comment options

Answer selected by sr1dar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Product Feedback Share your thoughts and suggestions on GitHub features and improvements
2 participants