oNaiPs / secrets-to-env-action

Export your GitHub Actions secrets to environment variables
MIT License
89 stars 29 forks source link

Added option to convert secrets to base64 #303

Open danilokorber opened 7 months ago

danilokorber commented 7 months ago

Converts all exported secrets to a base64 string (default is false):

steps:
- uses: actions/checkout@v3
- uses: oNaiPs/secrets-to-env-action@v1
  with:
    secrets: ${{ toJSON(secrets) }}
    value_as_base64: true
- run: echo "Value of my_secret: $my_secret"

If value_as_base64 is true, the value of the secret will be converted to a base64 string.

danilokorber commented 7 months ago

@danilokorber thanks for the PR. Since we already have an attribute convert that allows you to convert the inputs, let's use convert: base64 instead to achieve your goal? Thanks

Hey @oNaiPs I thought of using the convert attribute, but I thought this could be confusing, since convert is used to change the key and this PR is to change the value. Additionally, this allows us to change the key to the desired form AND the value to base64.

Please let me know if you still want to use the convert option for this. What we also can do, is change the option to convert_value and accept base64 as value. This would prepare the action to other conversion types in the future.