/dotenv-output-action

Github Action that reads .env files and provides it's contents as outputs.

Primary LanguageJavaScriptMIT LicenseMIT

dotenv output action

This Github Action reads items from provided environment file (.env) and provides outputs with their values.

Build history

Build history

Inputs

  • path - Override the path to the .env file. Default is .env in the repository root.
  • log-variables - Log variables after reading from the .env file and output a table to the workflow summary (default: true).
  • mask-variables - Mask values after reading from the .env file (default: false).

Outputs

  • generic - Whatever is present in the .env file will be converted into an output variable.

E.g. you have the following .env:

  VERSION=1.0
  AUTHOR=Mickey Mouse
  MYARRAY=1,2,3

Then you will have outputs:

  • version: 1.0
  • author: Mickey Mouse
  • myarray: 1,2,3
  • myarray_element_0: 1
  • myarray_element_1: 2
  • myarray_element_2: 3

Example usage

Assuming the following .env file:

hello=world
- name: dotenv
  id: dotenv
  uses: sammcj/dotenv-output-action@main

- name: echo hello world
  run: echo "hello ${{ steps.dotenv.outputs.hello }}"
  # Will output "Hello world"

Full example:

- name: dotenv
  id: dotenv
  uses: sammcj/dotenv-output-action@main
  with:
    path: .github/.github.env
    log-variables: true
    mask-variables: false

Screenshot

screenshot

Credits