devbox icon indicating copy to clipboard operation
devbox copied to clipboard

Docs: Suggest direnv-action for Github CI

Open Leksat opened this issue 1 year ago • 3 comments

What problem are you trying to solve?

https://www.jetify.com/devbox/docs/continuous_integration/github_action/ suggests to use jetify-com/devbox-install-action and then wrap all workflow commands with devbox run "...". The latter can be error prone - one might forget to wrap a newly added step.

What solution would you like?

Mention https://github.com/marketplace/actions/direnv-action on the docs.

Something like

Tip: direnv-action can be used for direnv setups. Then devbox environment will be applied automatically to all workflow steps.

(And maybe a small workflow example?)

Alternatives you've considered

Do nothing and close this issue :)

Leksat avatar Sep 11 '24 19:09 Leksat

Adding direnv-action is just this:

    - name: Load devbox via direnv
      uses: HatsuneMiku3939/direnv-action@v1

Leksat avatar Sep 11 '24 19:09 Leksat

Very interesting! A few questions:

  1. Have you used this on your Devbox setups in CI?
  2. Does this work well in monorepo type setups? Or does it only load 1 direnv config?

Lagoja avatar Sep 11 '24 20:09 Lagoja

@Lagoja

  1. Have you used this on your Devbox setups in CI?

Yes. Currently it's in a PR https://github.com/AmazeeLabs/silverback-template/pull/338 but looks quite promising. Everything works as expected.

  1. Does this work well in monorepo type setups? Or does it only load 1 direnv config?

Hmm. I quickly checked the source. It looks like it only takes the root .envrc into account.

So, yeah, it can work only for simple setups.

Leksat avatar Sep 11 '24 21:09 Leksat