Skip to content

feat: export env vars from mise.toml#241

Merged
jdx merged 8 commits intojdx:mainfrom
maelp:patch-1
Aug 18, 2025
Merged

feat: export env vars from mise.toml#241
jdx merged 8 commits intojdx:mainfrom
maelp:patch-1

Conversation

@maelp
Copy link
Copy Markdown
Contributor

@maelp maelp commented Aug 18, 2025

Solve #36

BREAKING CHANGE: we're defaulting this behavior to true

@maelp maelp requested a review from jdx as a code owner August 18, 2025 15:28
Comment thread action.yml Outdated
autoload-env:
description: "Automatically load mise env vars into GITHUB_ENV"
required: false
default: "false"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would default to true and we can do a semver major bump

Comment thread action.yml Outdated
required: false
default: "true"
description: If true (default), fetch the mise binary from GitHub. If false and using the latest version, fetch from mise.jdx.dev instead.
autoload-env:
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just name this env

@jdx
Copy link
Copy Markdown
Owner

jdx commented Aug 18, 2025

needs tests

@maelp
Copy link
Copy Markdown
Contributor Author

maelp commented Aug 18, 2025

@jdx not sure how to add test to those, care to help me/show me where and how it can be done?

@maelp
Copy link
Copy Markdown
Contributor Author

maelp commented Aug 18, 2025

@jdx I tried to edit this locally to run npm format:write but when I do a npm install I get this, any idea?

! command sh -c napi-postinstall unrs-resolver 1.11.1 check
npm ERR! /private/tmp/mise-action/node_modules/napi-postinstall/lib/index.js:57
npm ERR!     return process.env.npm_config_user_agent?.startsWith('npm/');
npm ERR!                                              ^
npm ERR!
npm ERR! SyntaxError: Unexpected token '.'
npm ERR!     at wrapSafe (internal/modules/cjs/loader.js:1067:16)
npm ERR!     at Module._compile (internal/modules/cjs/loader.js:1115:27)
npm ERR!     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
npm ERR!     at Module.load (internal/modules/cjs/loader.js:1000:32)
npm ERR!     at Function.Module._load (internal/modules/cjs/loader.js:899:14)
npm ERR!     at Module.require (internal/modules/cjs/loader.js:1040:19)
npm ERR!     at require (internal/modules/cjs/helpers.js:72:18)
npm ERR!     at Object.<anonymous> (/private/tmp/mise-action/node_modules/napi-postinstall/lib/cli.js:4:20)
npm ERR!     at Module._compile (internal/modules/cjs/loader.js:1151:30)
npm ERR!     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/primet/.npm/_logs/2025-08-18T15_36_28_528Z-debug.log

@jdx
Copy link
Copy Markdown
Owner

jdx commented Aug 18, 2025

my guess is your node version is out of date. You can find existing tests in github actions.

@maelp
Copy link
Copy Markdown
Contributor Author

maelp commented Aug 18, 2025

@jdx okay I have added a test

@maelp
Copy link
Copy Markdown
Contributor Author

maelp commented Aug 18, 2025

It seems working, just added a test env MY_ENV_VAR = "abc" and check that I can find it in the environment afterwards

@risu729
Copy link
Copy Markdown
Contributor

risu729 commented Aug 18, 2025

I'm not sure if PATH can be overwritten in GitHub Actions, so it could be better to add a test for env._.path.
https://mise.jdx.dev/environments/#env-path


It might collide with the GITHUB_PATH, used in:

core.addPath(shimsDir)

@maelp
Copy link
Copy Markdown
Contributor Author

maelp commented Aug 18, 2025

@risu729 not sure about what you're saying? would you mind updating the PR for this? shouldn't any path extension be already added to the .env when using mise env --dotenv?

@risu729
Copy link
Copy Markdown
Contributor

risu729 commented Aug 18, 2025

Sorry, I was wrong. It seems mise env --dotenv doesn't print PATH even if env._.path is configured.
This means the paths in env._.path cannot be used in GitHub Actions. However, the tool paths are appended by the shims.

@jdx
Copy link
Copy Markdown
Owner

jdx commented Aug 18, 2025

This means the paths in env._.path cannot be used in GitHub Actions.

that would probably be quite hard to support, we should document this as a gap though

Comment thread action.yml Outdated
@jdx jdx changed the title Add autoload-env feat: env vars in mise.toml Aug 18, 2025
@jdx jdx changed the title feat: env vars in mise.toml feat: export env vars from mise.toml Aug 18, 2025
@maelp
Copy link
Copy Markdown
Contributor Author

maelp commented Aug 18, 2025

@jdx @risu729 do you take over from here, or do you need me to update something?

@jdx jdx enabled auto-merge (squash) August 18, 2025 16:33
@jdx jdx merged commit f0b1d70 into jdx:main Aug 18, 2025
16 checks passed
@jdx jdx mentioned this pull request Aug 18, 2025
jdx added a commit that referenced this pull request Aug 18, 2025
---
## [3.0.0](https://github.com/jdx/mise-action/compare/v2.4.4..v3.0.0) -
2025-08-18

### 🚀 Features

- **breaking** export env vars from mise.toml (#241) by
[@maelp](https://github.com/maelp) in
[#241](#241)

### New Contributors

* @maelp made their first contribution in
[#241](#241)

<!-- generated by git-cliff -->

Co-authored-by: mise-en-dev <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants