I have a GitHub environment secret {{ secrets.GITHUBAPP_KEY }
that holds a .pem key, in a workflow step, I'm trying to pass the secret to an env variable GITHUBAPP_KEY
- name: Do Certain Step
run: Insert fancy command here
env:
GITHUBAPP_KEY: "${{ secrets.GITHUBAPP_KEY }}"
Here is the error the GitHub actio workflow gets when I run it:
error: error parsing STDIN: invalid Yaml document separator: --END RSA PRIVATE KEY-----"
The key is the correct format, I have also wrapped double quotes around the secrets context, yet, the file still does not get parsed correctly.
How can I solve this issue?
As the SSH private key is spanned over multiple lines, you can assign it to an env var as a multiline string by using pipe |
like this:
env:
GITHUBAPP_KEY: |
${{ secrets.GITHUBAPP_KEY }}
See https://yaml-multiline.info/ for interactive examples.