I read some similar posts but none seem to answer this question. I can set individual GitHub secrets into environment variables in an Action if I know the name of the secret:
env:
PW_ID0007: "${{secrets.PW_ID0007}}"
How can I expose all secrets as environment variables without knowing their names (either in bulk or some way to iterate through them and set them individually?)
There is a way to do that. Please check here
- name: view the secrets context
shell: bash
run: echo "$SECRETS_CONTEXT"
env:
SECRETS_CONTEXT: ${{ toJson(secrets) }}
In that way you will expose all secrets without knowing names:
And know what you need is go through this json using for instance jq and set them as env variable suing following syntax:
echo "variable_name=variable_value" >> $GITHUB_ENV
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With