[GH-ISSUE #279] Allow loading secrets from a .env file #193

Closed
opened 2026-03-01 21:41:05 +03:00 by kerem · 4 comments
Owner

Originally created by @patoroco on GitHub (Jun 14, 2020).
Original GitHub issue: https://github.com/nektos/act/issues/279

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?

Originally created by @patoroco on GitHub (Jun 14, 2020). Original GitHub issue: https://github.com/nektos/act/issues/279 Hi, currently `act` supports passing the secrets using the shell in two ways: ```bash 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?
kerem 2026-03-01 21:41:05 +03:00
Author
Owner

@MAHDTech commented on GitHub (Jun 15, 2020):

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"

👍

<!-- gh-comment-id:644037849 --> @MAHDTech commented on GitHub (Jun 15, 2020): You can try this, works for both secrets and standard environment variables. * Create a file to store the environment variable secrets ```bash vim ~/.config/act.vault # Example secret MY_SECRET=12345 ``` * Then run act and load the files with the variables ```bash act \ --env-file "${HOME}/.config/act.env" \ --secret-file "${HOME}/.config/act.vault" ``` 👍
Author
Owner

@cplee commented on GitHub (Jun 15, 2020):

thanks @MAHDTech!

@patoroco - can we close this?

<!-- gh-comment-id:644236523 --> @cplee commented on GitHub (Jun 15, 2020): thanks @MAHDTech! @patoroco - can we close this?
Author
Owner

@patoroco commented on GitHub (Jun 15, 2020):

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: github.com/nektos/act@2f395475b0/pkg/runner/testdata/secrets/.actrc (L2)

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

<!-- gh-comment-id:644253826 --> @patoroco commented on GitHub (Jun 15, 2020): 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?
Author
Owner

@patoroco commented on GitHub (Jun 16, 2020):

thanks @MAHDTech!

@patoroco - can we close this?

Done! Thanks

<!-- gh-comment-id:644763009 --> @patoroco commented on GitHub (Jun 16, 2020): > thanks @MAHDTech! > > > > @patoroco - can we close this? Done! Thanks
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#193
No description provided.