@@ -91829,6 +91829,9 @@ function getOSInfo() {
9182991829 });
9183091830}
9183191831exports.getOSInfo = getOSInfo;
91832+ function isString(value) {
91833+ return typeof value === 'string' || value instanceof String;
91834+ }
9183291835/**
9183391836 * Extract a value from an object by following the keys path provided.
9183491837 * If the value is present, it is returned. Otherwise undefined is returned.
@@ -91839,9 +91842,12 @@ function extractValue(obj, keys) {
9183991842 if (keys.length > 1 && value !== undefined) {
9184091843 return extractValue(value, keys.slice(1));
9184191844 }
91842- else {
91845+ else if (isString(value)) {
9184391846 return value;
9184491847 }
91848+ else {
91849+ return;
91850+ }
9184591851 }
9184691852 else {
9184791853 return;
@@ -91859,19 +91865,26 @@ function getVersionInputFromTomlFile(versionFile) {
9185991865 core.debug(`Trying to resolve version form ${versionFile}`);
9186091866 const pyprojectFile = fs_1.default.readFileSync(versionFile, 'utf8');
9186191867 const pyprojectConfig = toml.parse(pyprojectFile);
91862- let keys = [];
91868+ let keyPaths = [];
9186391869 if ('project' in pyprojectConfig) {
9186491870 // standard project metadata (PEP 621)
91865- keys = ['project', 'requires-python'];
91871+ keyPaths = [[ 'project', 'requires-python'] ];
9186691872 }
9186791873 else {
91868- // python poetry
91869- keys = ['tool', 'poetry', 'dependencies', 'python'];
91874+ keyPaths = [
91875+ // python poetry
91876+ ['tool', 'poetry', 'dependencies', 'python'],
91877+ // mise
91878+ ['tools', 'python'],
91879+ ['tools', 'python', 'version']
91880+ ];
9187091881 }
9187191882 const versions = [];
91872- const version = extractValue(pyprojectConfig, keys);
91873- if (version !== undefined) {
91874- versions.push(version);
91883+ for (const keys of keyPaths) {
91884+ const value = extractValue(pyprojectConfig, keys);
91885+ if (value !== undefined) {
91886+ versions.push(value);
91887+ }
9187591888 }
9187691889 core.info(`Extracted ${versions} from ${versionFile}`);
9187791890 const rawVersions = Array.from(versions, version => version.split(',').join(' '));
0 commit comments