mirror of
https://github.com/dtolnay/rust-toolchain.git
synced 2025-07-04 12:48:19 +00:00
Profiles and components support
This commit is contained in:
parent
74865b8fc9
commit
f0a61e6769
10 changed files with 5143 additions and 891 deletions
47
src/args.ts
47
src/args.ts
|
@ -1,43 +1,26 @@
|
|||
import * as core from '@actions/core';
|
||||
|
||||
// Workaround for a GH bug: https://github.com/actions/toolkit/issues/127
|
||||
//
|
||||
// For input `all-features: true` it will generate the `INPUT_ALL-FEATURES: true`
|
||||
// env variable, which looks too weird.
|
||||
// Here we are trying to get proper name `INPUT_NO_DEFAULT_FEATURES` first,
|
||||
// and if it does not exist, trying the `INPUT_NO-DEFAULT-FEATURES`
|
||||
function getInput(name: string, options?: core.InputOptions): string {
|
||||
const inputFullName = name.replace(/-/g, '_');
|
||||
let value = core.getInput(inputFullName, options);
|
||||
if (value.length > 0) {
|
||||
return value
|
||||
}
|
||||
|
||||
return core.getInput(name)
|
||||
}
|
||||
|
||||
function inputBoolean(name: string): boolean {
|
||||
const value = getInput(name);
|
||||
if (value == 'true' || value == '1') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
import {input} from '@actions-rs/core';
|
||||
|
||||
export interface ToolchainOptions {
|
||||
name: string,
|
||||
target?: string,
|
||||
target: string | undefined,
|
||||
default: boolean,
|
||||
override: boolean
|
||||
override: boolean,
|
||||
profile: string | undefined,
|
||||
components: string[] | undefined,
|
||||
}
|
||||
|
||||
export function toolchain_args(): ToolchainOptions {
|
||||
let components: string[] | undefined = input.getInputList('components');
|
||||
if (components && components.length === 0) {
|
||||
components = undefined;
|
||||
}
|
||||
return {
|
||||
name: getInput('toolchain', {required: true}),
|
||||
target: getInput('target') || undefined,
|
||||
default: inputBoolean('default'),
|
||||
override: inputBoolean('override')
|
||||
name: input.getInput('toolchain', {required: true}),
|
||||
target: input.getInput('target') || undefined,
|
||||
default: input.getInputBool('default'),
|
||||
override: input.getInputBool('override'),
|
||||
profile: input.getInput('profile') || undefined,
|
||||
components: components,
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue