mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2026-04-01 07:03:17 +08:00
Sarpik/get input list support (#829)
* feat(core): Create `getInputList` utility Signed-off-by: Kipras Melnikovas <kipras@kipras.org> * chore(core): Document usage of '\n' instead of [] @ `getInputList` Signed-off-by: Kipras Melnikovas <kipras@kipras.org> * test(core): Create a very simple test for `getInputList` Signed-off-by: Kipras Melnikovas <kipras@kipras.org> * run linter * update commands/readme Co-authored-by: Kipras Melnikovas <kipras@kipras.org>
This commit is contained in:
@@ -100,6 +100,25 @@ export function getInput(name: string, options?: InputOptions): string {
|
||||
return val.trim()
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the values of an multiline input. Each value is also trimmed.
|
||||
*
|
||||
* @param name name of the input to get
|
||||
* @param options optional. See InputOptions.
|
||||
* @returns string[]
|
||||
*
|
||||
*/
|
||||
export function getMultilineInput(
|
||||
name: string,
|
||||
options?: InputOptions
|
||||
): string[] {
|
||||
const inputs: string[] = getInput(name, options)
|
||||
.split('\n')
|
||||
.filter(x => x !== '')
|
||||
|
||||
return inputs
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
|
||||
* Support boolean input list: `true | True | TRUE | false | False | FALSE` .
|
||||
|
||||
Reference in New Issue
Block a user