Pin direnv
Use a known direnv version when workflow behavior must stay stable. Cold installs verify the binary digest before execution or caching.
- uses: HatsuneMiku3939/direnv-action@v1.4.6
with:
direnvVersion: 2.37.1
A compact action for installing direnv, exporting a trusted environment, validating required names, and carrying those variables into later workflow steps.
$ direnv allow child
allowed .envrc
$ direnv export json
exported: CHILD_ENV, PATH, SECRET1
$ validate required
found: CHILD_ENV, SECRET1
$ mask secrets
redacted configured values
dist/index.js.
.envrc.
.envrc files.
Pin an exact release for repeatable builds. Use @v1 only when the workflow should receive
compatible updates automatically.
steps:
- uses: actions/checkout@v7
- uses: HatsuneMiku3939/direnv-action@v1.4.6
with:
direnvVersion: 2.37.1
masks: SECRET1, SECRET2
dependents.info renders public GitHub dependency graph dependents for this repository.
| Name | Default | Use it for |
|---|---|---|
direnvVersion |
2.37.1 |
Selecting the direnv binary version installed from release assets or cache. |
direnvChecksum |
'' |
Optionally pinning the SHA-256 digest expected for the downloaded direnv binary. |
masks |
'' |
Comma-separated environment variable names whose exported values should be redacted from logs. |
required |
'' |
Newline-delimited environment variable names that must exist after direnv export json. |
path |
. |
Directory where direnv allow and direnv export json run. |
Use a known direnv version when workflow behavior must stay stable. Cold installs verify the binary digest before execution or caching.
- uses: HatsuneMiku3939/direnv-action@v1.4.6
with:
direnvVersion: 2.37.1
By default the action uses the GitHub Release API asset digest. Provide direnvChecksum for an independent SHA-256 pin.
- uses: HatsuneMiku3939/direnv-action@v1.4.6
with:
direnvVersion: 2.37.1
direnvChecksum: sha256:1f1b93dd6f38523fde26dfac96151ef9d31a374e3005cd3345fb93555ae0c9b5
List exported variable names. Do not paste raw secret values into masks.
- uses: HatsuneMiku3939/direnv-action@v1.4.6
with:
masks: SECRET1, SECRET2
Fail the step before exporting anything when expected variables are missing.
- uses: HatsuneMiku3939/direnv-action@v1.4.6
with:
required: |
AWS_REGION
DATABASE_URL
NODE_AUTH_TOKEN
Point path at the directory containing the target .envrc.
- uses: HatsuneMiku3939/direnv-action@v1.4.6
with:
path: child
Check that path points at the intended .envrc and that
direnv export json exports every name listed in required.
Confirm masks contains variable names such as SECRET1, not the secret values.
When .envrc exports PATH, the action appends it through the GitHub Actions path API.
Later steps in the same job receive the updated path.
Confirm direnvVersion and direnvChecksum refer to the same upstream binary. If
direnvChecksum is not set, retry after checking that the upstream GitHub release asset metadata is
available.
.envrc is executable project configuration. Treat it as code, especially in workflows that can access
repository secrets, cloud credentials, deployment tokens, or production infrastructure.
.envrc contents.direnv binary before making it executable or saving it to
cache. By default this uses the GitHub Release API asset digest; set direnvChecksum for a
stronger independent pin.
pull_request_target workflows. If you use
pull_request_target, do not check out and run a fork-provided .envrc in a job that
has access to secrets.
pull_request with minimal permissions and without repository secrets unless the
.envrc contents are trusted.
required input to fail early when expected exported variables are missing. This helps
prevent downstream steps from running with incomplete configuration, but it is not a sandbox or a
secret-protection boundary.
permissions: as narrow as possible and avoid passing long-lived credentials into
jobs that evaluate changing .envrc files.
This site is published from GitHub Pages using branch master and folder /docs.
Keep this page aligned with README.md and action.yml.
When preparing a release that changes the exact pinned tag, update both README.md and this page.