This commit is contained in:
Stefan Kuhn 2023-04-23 12:03:59 +00:00
parent 994f0bec47
commit baf9479bf9

View file

@ -94,27 +94,27 @@ export function detectToolchain(): Toolchain {
});
} else {
core.info('Loading rust-toolchain.toml or rust-toolchain file');
const toolchainFile = core.getInput('rust-toolchain-file');
const toolchainFile = core.getInput('rust-toolchain-file');
if (toolchainFile) {
if (fs.existsSync(toolchainFile)) {
Object.assign(toolchain, parseConfig(toolchainFile));
} else {
core.setFailed('Not found toolchain config file');
throw new Error('Not found toolchain config file');
}
} else {
for (const configName of ['rust-toolchain.toml', 'rust-toolchain']) {
const configPath = path.join(process.cwd(), configName);
if (toolchainFile) {
if (fs.existsSync(toolchainFile)) {
Object.assign(toolchain, parseConfig(toolchainFile));
} else {
core.setFailed('Not found toolchain config file');
throw new Error('Not found toolchain config file');
}
} else {
for (const configName of ['rust-toolchain.toml', 'rust-toolchain']) {
const configPath = path.join(process.cwd(), configName);
if (fs.existsSync(configPath)) {
core.debug(`Found ${configName}, parsing TOML`);
if (fs.existsSync(configPath)) {
core.debug(`Found ${configName}, parsing TOML`);
Object.assign(toolchain, parseConfig(configPath));
break;
}
}
}
Object.assign(toolchain, parseConfig(configPath));
break;
}
}
}
}
core.info('Inheriting toolchain settings from inputs');