feat: add support for mise.toml file (#1421)

* feat: add support for mise.toml file

feat: add support for mise.toml file

feat: update licensed cache

feat: switch from js-toml to smol-toml to reduce deps and bundle size

* feat: added docs and improved tests

* feat: added docs and improved tests

* ci: fix ci

* ci: fix ci
This commit is contained in:
Gustavo Perdomo
2026-08-13 15:16:13 -05:00
committed by GitHub
parent 12b7ff3796
commit 1acbd4c02f
14 changed files with 2864 additions and 68 deletions
+21
View File
@@ -1,6 +1,7 @@
import * as core from '@actions/core';
import * as exec from '@actions/exec';
import * as io from '@actions/io';
import {parse} from 'smol-toml';
import fs from 'fs';
import path from 'path';
@@ -68,6 +69,26 @@ export function getNodeVersionFromFile(versionFilePath: string): string | null {
core.info('Node version file is not JSON file');
}
// Try parsing the file as a mise `mise.toml` file.
try {
const manifest: Record<string, any> = parse(contents);
if (manifest?.tools?.node) {
const node = manifest.tools.node;
if (typeof node === 'object' && node?.version) {
return node.version;
}
if (typeof node === 'string') {
return node;
}
return null;
}
} catch {
core.info('Node version file is not TOML file');
}
const found = contents.match(/^(?:node(js)?\s+)?v?(?<version>[^\s]+)$/m);
return found?.groups?.version ?? contents.trim();
}