branch-env-vars icon indicating copy to clipboard operation
branch-env-vars copied to clipboard

Is there a way to support multiline values?

Open kiriakos opened this issue 2 years ago • 2 comments

Hi, thanks for creating this action, I have been using it quite successfully in the past months. Today I stumbled on an error when one of the secrets I was interpolating into the values contained newlines. Is there a way to work around this?

jobs:
  deploy:
    steps:
     - name: Set branch-based environment variables
        uses: iamtheyammer/[email protected]
        with:
          WORKING_SEC: |
            main:${{ secrets.PRODUCTION_SECRET }}
            develop:${{ secrets.DEVELOPMENT_SECRET }}
            staging:${{ secrets.STAGING_SECRET }}
          NEWLINE_SEC: |
            main:${{ secrets.PRODUCTION_SECRET_W_NEWLINE }}
            develop:${{ secrets.DEVELOPMENT_SECRET_W_NEWLINE }}
            staging:${{ secrets.STAGING_SECRET_W_NEWLINE }}

If the values to the secrets have newlines, eg: secrets.PRODUCTION_SECRET_W_NEWLINE contains


hello
world

the step will fail with the error message: Error: Invalid value for NEWLINE_SEC: *** does not contain a colon

kiriakos avatar Jul 04 '22 16:07 kiriakos

This is a really interesting edge case. I'll have to fix #11 first, but I'll either make multiline values default or require something like

branch\:multi
line
value
anotherbranch:singlelinevalue
```.

iamtheyammer avatar Jul 05 '22 19:07 iamtheyammer

Is there any update on the fix?

pravinprabhat avatar Mar 11 '23 10:03 pravinprabhat