Made it possible to add component

This commit is contained in:
Yen-Lin Chen 2019-09-20 22:45:47 -07:00
parent 8e306a9c7f
commit 9aeef8beba
3 changed files with 10 additions and 2 deletions

View File

@ -25,6 +25,7 @@ jobs:
with:
toolchain: nightly
override: true
component: clippy
# `cargo check` command here will use installed `nightly`
# as it set as an "override" for current directory
@ -44,6 +45,7 @@ See [additional recipes here](https://github.com/actions-rs/meta).
* `target`: Additionally install specific target for this toolchain (ex. `x86_64-apple-darwin`)
* `default`: Set installed toolchain as default (executes `rustup toolchain default {toolchain}`)
* `override`: Set installed toolchain as an override for current directory
* `component`: Set additional component (see the below section) to add to the toolchain
## Components

View File

@ -30,7 +30,8 @@ export interface ToolchainOptions {
name: string,
target?: string,
default: boolean,
override: boolean
override: boolean,
component?: string
}
export function toolchain_args(): ToolchainOptions {
@ -38,6 +39,7 @@ export function toolchain_args(): ToolchainOptions {
name: getInput('toolchain', {required: true}),
target: getInput('target') || undefined,
default: inputBoolean('default'),
override: inputBoolean('override')
override: inputBoolean('override'),
component: getInput('component') || undefined
};
}

View File

@ -89,6 +89,10 @@ async function run() {
if (opts.target) {
await exec.exec(rustup, ['target', 'add', '--toolchain', opts.name, opts.target]);
}
if (opts.component) {
await exec.exec(rustup, ['component', 'add', opts.component, '--toolchain', opts.name]);
}
}
async function main() {