GithubHelp home page GithubHelp logo

dotenv-action's People

Contributors

benlei avatar dariuszporowski avatar dependabot[bot] avatar f21 avatar falti avatar franciscokloganb avatar oschlegel avatar sammcj avatar tjcorr avatar vlukashov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dotenv-action's Issues

[feature request] adhere to dotenv common behaviour

As a user
I want the action not to fail
When the .env file that was specified does not exist
Because this is the way dotenv extensions, plugins and NPM packages usually work

To avoid breaking changes this could be an input.fail-on-not-found or something.

Thanks! :)

Can an option be added to prefix exported envs?

For example if I have an .env with:

foo=123

I may want to export the env variables with the prefix TF_VAR_ so that Terraform can automatically process the foo variable... as well as be able to reference the step.my-step.outputs.foo in my workflow.

Exporting environment variables makes their names lowercase

Using export-variables: true makes the name of variable lowercase inside following steps.
i.e. WEB_PORT -> web_port, so you can't refer to it as ${WEB_PORT} how you would expect.

Expected behaviour: exporting environment variables keeps casing of their names.

Related to #42.

Support exporting as environment variables

I would like to propose the addition of an option (export-variables) that exports the key value pairs as environment variables in addition to setting them as the output.

This makes it easier to use this action with steps that expect the values in environment variables, meaning that we don't need to write an intermediate step that takes the output and exports them as environment variables.

GitHub Actions: `set-output` command is deprecated

Starting from October, 11th 2022 using the latest version of this action (falti/[email protected]) yields deprecation warnings:

The set-output command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

It looks like simply upgrading the @actions/core dependency to 1.10.0 or newer should fix this issue.

'set-output' command is deprecated and will be disabled soon

Imported your actions, but it seems they are still using the deprecated format for output when using it in the workflow it would prompt the warning:

Warning: The set-output command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

Think you can review and update?
nice action btw

define path in a directory?

I'm using a mono repo and I'm looking to define a path to a .env file in a package like so

- name: Load .env.development variables (Development)
  if: startsWith(github.ref, 'master') != true
  id: dotenv
  with:
    path: packages/website/.env.development

But no matter how I try to define the path I always get a ##[error]file does not exist error

Value in env file is ignored if the key defines an existing environment variable

I am trying to use this action to change the value of an existing environment variable but it appears to ignore the value in the env file in this case.

For example:
Environment already has FOO=BAR

Create env file with FOO=BAZ
Add this to the workflow

      - name: Setup environment
        uses: falti/[email protected]
        with:
          path: global.env
          keys-case: "bypass"
          log-variables: true
          export-variables: true

And observe the following in the log:

loading .env file from global.env
{
  FOO: 'BAR'
}

I'm not sure whether this behaviour is by design? Would it be possible to log a warning in this case or ideally provide a flag to have the dotenv-action override the existing key value with the new one?

[email protected] is not working when one environment variable value need to be used in another environment variable value

Example: Say, there is a .env file with below key/value pairs:

TEST_ENV=staging
BASE_URL=https://example-${TEST_ENV}.org

From the output, it's clear that it's not able to replace the value of TEST_ENV i.e., staging for the env variable BASE_URL i.e., https://example-staging.org

| loading .env file from ./tests/.env
| loaded 2 values into the environment
[Run Smoke Tests/test]   ⚙  ::set-output:: generic=please check for actual outputs
[Run Smoke Tests/test]   ⚙  ::set-output:: test_env=staging
[Run Smoke Tests/test]   ⚙  ::set-output:: base_url=https://example-${TEST_ENV}.org

Ideally, would expect the output to be:

| loading .env file from ./tests/.env
| loaded 2 values into the environment
[Run Smoke Tests/test]   ⚙  ::set-output:: generic=please check for actual outputs
[Run Smoke Tests/test]   ⚙  ::set-output:: test_env=staging
[Run Smoke Tests/test]   ⚙  ::set-output:: base_url=https://example-staging.org

Not sure, how to achieve this. Please advise.

Note: Used as below:

      - name: Dotenv Action
        id: dotenv
        uses: falti/[email protected]
        with:
          path: ./tests/.env

Not working?

Not sure what I'm doing wrong, but neither the upper or lower cases seem to net out with any values?

.env

GATSBY_SITE_URL = "https://test.domain.com"
GATSBY_STACKNAME = "brand-x-feat-submit"

workflow.yml

...
      - name: Slurp Up .env
        uses: falti/[email protected]

      - name: Test
        run: |
          echo "${{ steps.dotenv.outputs.gatsby_site_url }}"
          echo "${{ steps.dotenv.outputs.gatsby_stackname }}"
...

Also tried...which btw, feels more intuitive, not sure why it should lowercase them?

...
      - name: Slurp Up .env
        uses: falti/[email protected]

      - name: Test
        run: |
          echo "${{ steps.dotenv.outputs.GATSBY_SITE_URL }}"
          echo "${{ steps.dotenv.outputs.GATSBY_STACKNAME }}"
...

Error:
image

Select his own file instead of .env file

Hi,

Thanks for this great action that works fine.

As i'm using terraform and tfvars files, there's a duplication in defining environnemnt variables as i need to use a .env file now.

Would it be possible to be able to select my own file and path which contains variables ? with a different name than .env ?

Stable version tag `v1`

I think this action is stable so why don't we create a tag v1.

Other GitHub Actions use v1.0.0 and v1.

The tag v1 is used as an alias so it points to the latest stable version.

Multiline support

Hi @falti

can you please add a new feature to support multine values?

dotenv v15.0.0 supports multiline values.

for example;

PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----
...
Kh9NV...
...
-----END DSA PRIVATE KEY-----"

How to use this action ? Please provide an example ?

Not at all clear

Step 1: I created a .env file and added some data
Step 2: In existing workflow i used this action try to log it out and it is throwing an error, checkout action is not there ?

Please provide a clear example with a demo repository ?
Note : Don't know why people make actions and don't Provide example ?

Hope you guys provide it with a good example. How to use it

Thanks
Saiteja Gurram

Add `ensure-exists` to action.yml

ensure-exists is missing in the action.yml file, which triggers warnings while running (but it does work).

inputs:
path: # id of input
description: "the path to the .env file (including file name)"
required: true
default: ".env"
log-variables:
description: "whether to log the variables to output or not"
required: false
default: "false"
mask-variables:
description: "whether to mask the variables as secrets or not"
required: false
default: "false"
export-variables:
description: "whether to export the variables to the environment or not"
required: false
default: "false"
export-variables-prefix:
description: "prefix to add to the exported variables"
required: false
default: ""
keys-case:
description: "Transform keys case to lower, upper or keep as it is with bypass"
required: false
default: "lower"

  ensure-exists:
    description: "Fail the action when .env file is not found at path."
    required: false
    default: "true"

file does not exist

Hello @falti @oschlegel @falti where I'm I supposed to place my .env file? I am Getting file does not exist error. my folder structure looks like:
reporoot
  .github
      workflows
        githubaction.yml --i'm reading the .env from here
.env --this is the .env file

Please help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.