Act: Allow loading secrets from a .env file

Created on 14 Jun 2020  路  4Comments  路  Source: nektos/act

Hi,

currently act supports passing the secrets using the shell in two ways:

act -s SECRET=value

or

act -s SECRET

In the second option, if the SECRET environment variable exists, it will take that value, if not, it will prompt the user each time.

It would be really nice load these values directly from a .env file, what do you suggest?

kinquestion metworkaround

All 4 comments

You can try this, works for both secrets and standard environment variables.

  • Create a file to store the environment variable secrets
vim ~/.config/act.vault

# Example secret
MY_SECRET=12345
  • Then run act and load the files with the variables
act \
    --env-file "${HOME}/.config/act.env" \
    --secret-file "${HOME}/.config/act.vault"

馃憤

thanks @MAHDTech!

@patoroco - can we close this?

Oh, actually the @MAHDTech's explanation is not a workaround, it's just what I was looking for! Thanks @MAHDTech!

BTW, the only reference that I've found related to that is this file: https://github.com/nektos/act/blob/2f395475b0ac4f5c0fb3d7c8b97a23d9214ea77b/pkg/runner/testdata/secrets/.actrc#L2

Maybe we could add a small mention to it in the README, what do you think?

thanks @MAHDTech!

@patoroco - can we close this?

Done! Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

HoughIO picture HoughIO  路  4Comments

Applelo picture Applelo  路  5Comments

helaili picture helaili  路  4Comments

Sygmei picture Sygmei  路  3Comments

magiskboy picture magiskboy  路  3Comments