pass json variable from secret

Hi,

in my action I need to pass in a script a parameter taken from the secret variables.

this variable is a json.

if I do

script.sh ${{MY_SECREt}} (with or without quotes) the json is splitted to multiple parameters.

do you have a solution for this?

thank you very much

Hi @manang ,

In Github please avoid using structured data as the values of secrets. For example, avoid creating secrets that contain JSON or encoded Git blobs. Please check official doc here for more details.

Typically can use ‘jq’ (example here) to parse the value in json file, however it’s not supported for github secrets. And it should be by designed, since if it could be, the secrets is not safe then.

Thanks.

This is interesting given Microsoft explicitly calls for storing JSON as a secret for their Azure CLI Action here: https://github.com/Azure/cli

Seems to work fine through all my testing and is even redacted correctly through the console.