mirror of
https://github.com/jdx/mise-action.git
synced 2026-05-14 13:50:33 +00:00
feat: export env vars from mise.toml (#241)
Solve https://github.com/jdx/mise-action/issues/36 BREAKING CHANGE: we're defaulting this behavior to `true` --------- Co-authored-by: jdx <216188+jdx@users.noreply.github.com>
This commit is contained in:
parent
e7e48454f4
commit
f0b1d70eae
6 changed files with 22 additions and 2 deletions
5
.github/workflows/test.yml
vendored
5
.github/workflows/test.yml
vendored
|
|
@ -1,4 +1,4 @@
|
|||
name: 'build-test'
|
||||
name: "build-test"
|
||||
on: # rebuild any PRs and main branch changes
|
||||
pull_request:
|
||||
branches:
|
||||
|
|
@ -50,6 +50,9 @@ jobs:
|
|||
mise_toml: |
|
||||
[tools]
|
||||
jq = "1.7.1"
|
||||
|
||||
[env]
|
||||
MY_ENV_VAR = "abc"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- run: mise --version
|
||||
|
|
|
|||
|
|
@ -70,6 +70,10 @@ inputs:
|
|||
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.
|
||||
env:
|
||||
description: "Automatically load mise env vars into GITHUB_ENV. Note that PATH modifications are not part of this."
|
||||
required: false
|
||||
default: "true"
|
||||
outputs:
|
||||
cache-hit:
|
||||
description: A boolean value to indicate if a cache was hit.
|
||||
|
|
|
|||
5
dist/index.js
generated
vendored
5
dist/index.js
generated
vendored
|
|
@ -66558,6 +66558,11 @@ async function run() {
|
|||
}
|
||||
}
|
||||
await miseLs();
|
||||
const loadEnv = core.getBooleanInput('env');
|
||||
if (loadEnv) {
|
||||
const output = await exec.getExecOutput('mise', ['env', '--dotenv']);
|
||||
fs.appendFileSync(process.env.GITHUB_ENV, output.stdout);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
if (err instanceof Error)
|
||||
|
|
|
|||
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
|
|
@ -16,3 +16,6 @@ which jq
|
|||
if [[ "$(uname)" != "MINGW"* ]]; then
|
||||
assert_equal "$EXPECTED_OUTPUT" "$(jq --version)"
|
||||
fi
|
||||
|
||||
# checking that environment variables set in mise.toml are properly set
|
||||
assert_equal "${MY_ENV_VAR}" "abc"
|
||||
|
|
|
|||
|
|
@ -35,6 +35,11 @@ async function run(): Promise<void> {
|
|||
}
|
||||
}
|
||||
await miseLs()
|
||||
const loadEnv = core.getBooleanInput('env')
|
||||
if (loadEnv) {
|
||||
const output = await exec.getExecOutput('mise', ['env', '--dotenv'])
|
||||
fs.appendFileSync(process.env.GITHUB_ENV!, output.stdout)
|
||||
}
|
||||
} catch (err) {
|
||||
if (err instanceof Error) core.setFailed(err.message)
|
||||
else throw err
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue