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:
Thomas Boop
2021-06-04 09:28:49 -04:00
committed by GitHub
parent dc4b4dab1d
commit bb2f39337d
3 changed files with 30 additions and 0 deletions

View File

@@ -29,6 +29,8 @@ const testEnvVars = {
INPUT_WRONG_BOOLEAN_INPUT: 'wrong',
INPUT_WITH_TRAILING_WHITESPACE: ' some val ',
INPUT_MY_INPUT_LIST: 'val1\nval2\nval3',
// Save inputs
STATE_TEST_1: 'state_val',
@@ -166,6 +168,14 @@ describe('@actions/core', () => {
)
})
it('getMultilineInput works', () => {
expect(core.getMultilineInput('my input list')).toEqual([
'val1',
'val2',
'val3'
])
})
it('getInput trims whitespace by default', () => {
expect(core.getInput('with trailing whitespace')).toBe('some val')
})