question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Load `env` from files

See original GitHub issue

It would be awesome if env could be loaded from a file. Example:

name: Loading env vars from file
on:
  push:
    branches:
      - develop

env-file: dev.env
env:
  other-env-var: env-var-value

jobs:
  build:
    ...

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:34
  • Comments:13

github_iconTop GitHub Comments

31reactions
rgstephenscommented, Jan 9, 2021

Ended up doing it with the shell:

      - name: Import environment variables from a file
        id: import-env
        shell: bash
        run: |
          while read line; do
            echo "$line" >> $GITHUB_ENV
          done < ${{ env.ENV_FILE }}
24reactions
typebrookcommented, Jul 25, 2021

Ended up doing it with the shell:

      - name: Import environment variables from a file
        id: import-env
        shell: bash
        run: |
          while read line; do
            echo "$line" >> $GITHUB_ENV
          done < ${{ env.ENV_FILE }}

Why not just use cat?

run: cat ${{ env.ENV_FILE }} >> $GITHUB_ENV

or

run: < ${{ env.ENV_FILE }} >> $GITHUB_ENV
Read more comments on GitHub >

github_iconTop Results From Across the Web

Load environment variables from dotenv / .env file in Bash
Load environment variables from dotenv / .env file in Bash - load_dotenv.sh.
Read more >
Set environment variables from file of key/value pairs
And if you want to unset all of the variables defined in the file, use this: ... .env loading in the shell dotenv...
Read more >
Using .env Files for Environment Variables in Python ...
env file and if it finds one, it will load the environment variables from the file and make them accessible to your project...
Read more >
MATLAB loadenv
env file (dotenv) is a plain text file containing keys and their corresponding values that can be loaded into the MATLAB environment. By...
Read more >
dotenv: Load Environment Variables from '.env'
Alternatively a dotenv::load_dot_env() call can be used to load variables from arbitrary files. The format of the .env file is also a valid...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found