[GH-ISSUE #124] Support dotenv #82

Closed
opened 2026-03-01 21:39:56 +03:00 by kerem · 9 comments
Owner

Originally created by @muuvmuuv on GitHub (Mar 5, 2020).
Original GitHub issue: https://github.com/nektos/act/issues/124

I'm storing all my secrets passed to GitHub in a dotenv and it would be sooo helpful if I could do act -f .env pull_request.

Originally created by @muuvmuuv on GitHub (Mar 5, 2020). Original GitHub issue: https://github.com/nektos/act/issues/124 I'm storing all my secrets passed to GitHub in a dotenv and it would be sooo helpful if I could do `act -f .env pull_request`.
kerem closed this issue 2026-03-01 21:39:56 +03:00
Author
Owner

@cplee commented on GitHub (Mar 5, 2020):

Closing to keep discussion going on #123

@muuvmuuv - can you review the suggestion there and see if that would help or if .env is the better way to go

<!-- gh-comment-id:595304272 --> @cplee commented on GitHub (Mar 5, 2020): Closing to keep discussion going on #123 @muuvmuuv - can you review the suggestion there and see if that would help or if `.env` is the better way to go
Author
Owner

@cplee commented on GitHub (Mar 6, 2020):

implemented in #133

<!-- gh-comment-id:595952448 --> @cplee commented on GitHub (Mar 6, 2020): implemented in #133
Author
Owner

@muuvmuuv commented on GitHub (Mar 7, 2020):

Oh, that was fast! Sorry for the delay and thank you! :)

<!-- gh-comment-id:596103683 --> @muuvmuuv commented on GitHub (Mar 7, 2020): Oh, that was fast! Sorry for the delay and thank you! :)
Author
Owner

@muuvmuuv commented on GitHub (Mar 8, 2020):

Doesn't seem to work.

The .env.build is in the root.

❯ act -b -r -v --env-file .env.build fork
DEBU[0000] Loading environment from /Users/marvinheilemann/Development/Portfolio/.env.build
DEBU[0000] Loading workflows from '/Users/marvinheilemann/Development/Portfolio/.github/workflows'
DEBU[0000] Reading workflow '/Users/marvinheilemann/Development/Portfolio/.github/workflows/build.yml'
DEBU[0000] Reading workflow '/Users/marvinheilemann/Development/Portfolio/.github/workflows/fork.yml'
DEBU[0000] Reading workflow '/Users/marvinheilemann/Development/Portfolio/.github/workflows/lint.yml'
DEBU[0000] Reading workflow '/Users/marvinheilemann/Development/Portfolio/.github/workflows/notify.yml'
DEBU[0000] Reading workflow '/Users/marvinheilemann/Development/Portfolio/.github/workflows/stale.yml'
DEBU[0000] Planning event: fork
DEBU[0000] Loading slug from git directory '/Users/marvinheilemann/Development/Portfolio/.git'
DEBU[0000] Found revision: 078042c0e1c7955e49f19816f18a0a0c939bac50
DEBU[0000] Loading revision from git directory '/Users/marvinheilemann/Development/Portfolio/.git'
DEBU[0000] Found revision: 078042c0e1c7955e49f19816f18a0a0c939bac50
DEBU[0000] HEAD points to '078042c0e1c7955e49f19816f18a0a0c939bac50'
DEBU[0000] HEAD matches refs/heads/development
DEBU[0000] using github ref: refs/heads/development
[Fork created/Notify by email] 🚀  Start image=node:12.6-buster-slim
[Fork created/Notify by email]   🐳  docker pull node:12.6-buster-slim
DEBU[0000] Image exists? true
[Fork created/Notify by email]   🐳  docker create image=node:12.6-buster-slim entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[Fork created/Notify by email]   🐳  docker run image=node:12.6-buster-slim entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[Fork created/Notify by email] Starting container: ed74bfe31369405cd43a4ae9556f2d4bb89b46dae4fcb1e303091687208c53ea
[Fork created/Notify by email] Started container: ed74bfe31369405cd43a4ae9556f2d4bb89b46dae4fcb1e303091687208c53ea
DEBU[0000] Writing entry to tarball workflow/event.json len:2
DEBU[0000] Writing entry to tarball home/.act len:0
[Fork created/Notify by email] Extracting content to '/github/'
DEBU[0000] Loading slug from git directory '/Users/marvinheilemann/Development/Portfolio/.git'
DEBU[0000] Found revision: 078042c0e1c7955e49f19816f18a0a0c939bac50
DEBU[0000] Loading revision from git directory '/Users/marvinheilemann/Development/Portfolio/.git'
DEBU[0000] Found revision: 078042c0e1c7955e49f19816f18a0a0c939bac50
DEBU[0000] HEAD points to '078042c0e1c7955e49f19816f18a0a0c939bac50'
DEBU[0000] HEAD matches refs/heads/development
DEBU[0000] using github ref: refs/heads/development
[Fork created/Notify by email] ⭐  Run echo '${{secrets.MAIL_USERNAME}}'
DEBU[0000] Loading slug from git directory '/Users/marvinheilemann/Development/Portfolio/.git'
DEBU[0000] Found revision: 078042c0e1c7955e49f19816f18a0a0c939bac50
DEBU[0000] Loading revision from git directory '/Users/marvinheilemann/Development/Portfolio/.git'
DEBU[0000] Found revision: 078042c0e1c7955e49f19816f18a0a0c939bac50
DEBU[0000] HEAD points to '078042c0e1c7955e49f19816f18a0a0c939bac50'
DEBU[0000] HEAD matches refs/heads/development
DEBU[0000] using github ref: refs/heads/development
DEBU[0000] Wrote command 'echo 'undefined'' to 'workflow/0'
DEBU[0000] Writing entry to tarball workflow/0 len:32
[Fork created/Notify by email] Extracting content to '/github/'
[Fork created/Notify by email] Exec command '[bash --noprofile --norc -eo pipefail /github/workflow/0]'
| undefined
[Fork created/Notify by email]   ✅  Success - echo '${{secrets.MAIL_USERNAME}}'
name: Fork created

on:
  fork:

jobs:
  notify_email:
    name: Notify by email
    runs-on: ubuntu-latest

    steps:
      - run: echo '${{secrets.MAIL_USERNAME}}'
<!-- gh-comment-id:596204366 --> @muuvmuuv commented on GitHub (Mar 8, 2020): Doesn't seem to work. The `.env.build` is in the root. ``` ❯ act -b -r -v --env-file .env.build fork DEBU[0000] Loading environment from /Users/marvinheilemann/Development/Portfolio/.env.build DEBU[0000] Loading workflows from '/Users/marvinheilemann/Development/Portfolio/.github/workflows' DEBU[0000] Reading workflow '/Users/marvinheilemann/Development/Portfolio/.github/workflows/build.yml' DEBU[0000] Reading workflow '/Users/marvinheilemann/Development/Portfolio/.github/workflows/fork.yml' DEBU[0000] Reading workflow '/Users/marvinheilemann/Development/Portfolio/.github/workflows/lint.yml' DEBU[0000] Reading workflow '/Users/marvinheilemann/Development/Portfolio/.github/workflows/notify.yml' DEBU[0000] Reading workflow '/Users/marvinheilemann/Development/Portfolio/.github/workflows/stale.yml' DEBU[0000] Planning event: fork DEBU[0000] Loading slug from git directory '/Users/marvinheilemann/Development/Portfolio/.git' DEBU[0000] Found revision: 078042c0e1c7955e49f19816f18a0a0c939bac50 DEBU[0000] Loading revision from git directory '/Users/marvinheilemann/Development/Portfolio/.git' DEBU[0000] Found revision: 078042c0e1c7955e49f19816f18a0a0c939bac50 DEBU[0000] HEAD points to '078042c0e1c7955e49f19816f18a0a0c939bac50' DEBU[0000] HEAD matches refs/heads/development DEBU[0000] using github ref: refs/heads/development [Fork created/Notify by email] 🚀 Start image=node:12.6-buster-slim [Fork created/Notify by email] 🐳 docker pull node:12.6-buster-slim DEBU[0000] Image exists? true [Fork created/Notify by email] 🐳 docker create image=node:12.6-buster-slim entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[] [Fork created/Notify by email] 🐳 docker run image=node:12.6-buster-slim entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[] [Fork created/Notify by email] Starting container: ed74bfe31369405cd43a4ae9556f2d4bb89b46dae4fcb1e303091687208c53ea [Fork created/Notify by email] Started container: ed74bfe31369405cd43a4ae9556f2d4bb89b46dae4fcb1e303091687208c53ea DEBU[0000] Writing entry to tarball workflow/event.json len:2 DEBU[0000] Writing entry to tarball home/.act len:0 [Fork created/Notify by email] Extracting content to '/github/' DEBU[0000] Loading slug from git directory '/Users/marvinheilemann/Development/Portfolio/.git' DEBU[0000] Found revision: 078042c0e1c7955e49f19816f18a0a0c939bac50 DEBU[0000] Loading revision from git directory '/Users/marvinheilemann/Development/Portfolio/.git' DEBU[0000] Found revision: 078042c0e1c7955e49f19816f18a0a0c939bac50 DEBU[0000] HEAD points to '078042c0e1c7955e49f19816f18a0a0c939bac50' DEBU[0000] HEAD matches refs/heads/development DEBU[0000] using github ref: refs/heads/development [Fork created/Notify by email] ⭐ Run echo '${{secrets.MAIL_USERNAME}}' DEBU[0000] Loading slug from git directory '/Users/marvinheilemann/Development/Portfolio/.git' DEBU[0000] Found revision: 078042c0e1c7955e49f19816f18a0a0c939bac50 DEBU[0000] Loading revision from git directory '/Users/marvinheilemann/Development/Portfolio/.git' DEBU[0000] Found revision: 078042c0e1c7955e49f19816f18a0a0c939bac50 DEBU[0000] HEAD points to '078042c0e1c7955e49f19816f18a0a0c939bac50' DEBU[0000] HEAD matches refs/heads/development DEBU[0000] using github ref: refs/heads/development DEBU[0000] Wrote command 'echo 'undefined'' to 'workflow/0' DEBU[0000] Writing entry to tarball workflow/0 len:32 [Fork created/Notify by email] Extracting content to '/github/' [Fork created/Notify by email] Exec command '[bash --noprofile --norc -eo pipefail /github/workflow/0]' | undefined [Fork created/Notify by email] ✅ Success - echo '${{secrets.MAIL_USERNAME}}' ``` ```yml name: Fork created on: fork: jobs: notify_email: name: Notify by email runs-on: ubuntu-latest steps: - run: echo '${{secrets.MAIL_USERNAME}}' ```
Author
Owner

@cplee commented on GitHub (Mar 8, 2020):

You still need to define secrets via act -s MAIL_USERNAME

If you omit the value then act will look for an env variable that can be provided in the .env file

<!-- gh-comment-id:596219530 --> @cplee commented on GitHub (Mar 8, 2020): You still need to define secrets via `act -s MAIL_USERNAME` If you omit the value then act will look for an env variable that can be provided in the `.env` file
Author
Owner

@muuvmuuv commented on GitHub (Mar 8, 2020):

Ah, you should note that in the README, but why is that needed? Wouldn't it be cleaner if all the stuff from the dotenv is loaded as a secret?

<!-- gh-comment-id:596228459 --> @muuvmuuv commented on GitHub (Mar 8, 2020): Ah, you should note that in the README, but why is that needed? Wouldn't it be cleaner if all the stuff from the dotenv is loaded as a secret?
Author
Owner

@cplee commented on GitHub (Mar 8, 2020):

Good point @muuvmuuv - so in that case, would you like all environment variables to become available as secrets?

<!-- gh-comment-id:596263801 --> @cplee commented on GitHub (Mar 8, 2020): Good point @muuvmuuv - so in that case, would you like _all_ environment variables to become available as secrets?
Author
Owner

@muuvmuuv commented on GitHub (Mar 9, 2020):

Yes, for me the GitHub secrets page is nothing else than a local .env.

<!-- gh-comment-id:596502136 --> @muuvmuuv commented on GitHub (Mar 9, 2020): Yes, for me the GitHub secrets page is nothing else than a local `.env`.
Author
Owner

@sunt05 commented on GitHub (Apr 2, 2020):

You still need to define secrets via act -s MAIL_USERNAME

If you omit the value then act will look for an env variable that can be provided in the .env file

This is better documented; it took me quite a while to figure out this env file could work! 😅

<!-- gh-comment-id:607734281 --> @sunt05 commented on GitHub (Apr 2, 2020): > You still need to define secrets via `act -s MAIL_USERNAME` > > If you omit the value then act will look for an env variable that can be provided in the `.env` file This is better documented; it took me quite a while to figure out this `env` file could work! 😅
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#82
No description provided.