Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh secret set -f .env fails to parse secrets containing line breaks #6519

Closed
johnstonmatt opened this issue Oct 26, 2022 · 3 comments · Fixed by #6932
Closed

gh secret set -f .env fails to parse secrets containing line breaks #6519

johnstonmatt opened this issue Oct 26, 2022 · 3 comments · Fixed by #6932
Labels
blocked bug Something isn't working p3 Affects a small number of users or is largely cosmetic

Comments

@johnstonmatt
Copy link

johnstonmatt commented Oct 26, 2022

Describe the bug

A clear and concise description of what the bug is. Include version by typing gh --version.
version:

Steps to reproduce the behavior

  1. Create a file named .env (inside existing GitHub repo)
  2. Add the following contents:
FOO="
Hello World
This fails to parse
"
  1. run gh secret set -f .env
  2. read "error parsing env file: Can't separate key from value"

Expected vs actual behavior

I found myself saving public and private keys (for better or worse!) in GitHub Actions Secrets. Because the gh CLI cannot parse line breaks I need to replace any linebreaks in the file with some other seperator eg. _ so that my variable can exist on a single line.

I don't know where the spec exists (if there is one) for .env files, however I do know that within Deno these variables with line breaks were parsed without issues, they just couldn't be uploaded to github in that format.

Logs

gh secret set -f .env

error parsing env file: Can't separate key from value
@johnstonmatt johnstonmatt added the bug Something isn't working label Oct 26, 2022
@cliAutomation cliAutomation added the needs-triage needs to be reviewed label Oct 26, 2022
@BakaFT
Copy link
Contributor

BakaFT commented Oct 27, 2022

It seems like a upstream dependency problem that already fixed: joho/godotenv#156.

@mislav
Copy link
Contributor

mislav commented Oct 28, 2022

@johnstonmatt Thank you for reporting and thank you @BakaFT for linking the relevant PR. Once this is fixed upstream we can pull in the updated godotenv version 👍

@mislav mislav added blocked p3 Affects a small number of users or is largely cosmetic and removed needs-triage needs to be reviewed labels Oct 28, 2022
@johnstonmatt
Copy link
Author

@mislav i think the fix just landed upstream 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked bug Something isn't working p3 Affects a small number of users or is largely cosmetic
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants