Skip to content
Brett Delle Grazie edited this page Dec 1, 2022 · 1 revision

Using direnv with CI

Typically this is done using direnv exec:

direnv exec <DIR> <command> <arguments>
  • The first .envrc or .env is loaded from <DIR> and
  • direnv does not change the current working directory

For example:

direnv exec ci ci/ci.sh

Alternatively, the behaviour of .envrc can be customised based on an environment variable. The environment variable CI is normally set by most CI systems.

For example:

if [[ -n "${CI:-}" ]]; then
  # do the CI setup here
else
  # do the user setup here
end
Clone this wiki locally