diff --git a/action.yml b/action.yml index 8a52c54..9efcb4a 100644 --- a/action.yml +++ b/action.yml @@ -17,6 +17,9 @@ inputs: description: 'Comma-separated list of additional targets to install.' profile: description: 'Profile to install. Defaults to "minimal".' + inherit-toolchain: + description: 'Inherit all toolchain settings from the rust-toolchain.toml file.' + default: false outputs: cache-key: description: 'The generated cache key used.' diff --git a/src/rust.ts b/src/rust.ts index a2a2459..6aac44f 100644 --- a/src/rust.ts +++ b/src/rust.ts @@ -69,10 +69,18 @@ export function parseConfig(configPath: string): Partial { const config = TOML.parse(contents) as unknown as ToolchainConfig; - if (config.toolchain.channel) { - core.debug('Found channel in [toolchain] section'); + if (config.toolchain) { + if (core.getBooleanInput('inherit-toolchain')) { + core.debug('Inheriting entire [toolchain] section'); - return { channel: config.toolchain.channel }; + return { ...config.toolchain }; + } + + if (config.toolchain.channel) { + core.debug('Found channel in [toolchain] section'); + + return { channel: config.toolchain.channel }; + } } core.debug('No channel found in [toolchain] section');