-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
31 lines (24 loc) · 873 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const core = require('@actions/core');
const RUN_ALL_IDENTIFIER = 'all'
try {
// Get input value
const inputString = core.getInput('value');
const inputDelimter = core.getInput('delimiter');
const runAllDefaultValues = core.getInput('run-all-default-values');
let inputValueToSplit = inputString;
if (inputString.toLowerCase() === RUN_ALL_IDENTIFIER) {
inputValueToSplit = runAllDefaultValues;
}
const splittedString = inputValueToSplit.split(inputDelimter || ',').filter(Boolean);
core.info(`Parsed string: ${splittedString}`);
// Set an output value
if (splittedString.length) {
core.setOutput('parsed', splittedString);
core.setOutput('is-empty', false);
} else {
core.info('No values after parsing. Setting is-empty to true');
core.setOutput('is-empty', true);
}
} catch (error) {
core.setFailed(error.message);
}