diff --git a/action-src/main.ts b/action-src/main.ts index 60f395b09..4580c71b8 100755 --- a/action-src/main.ts +++ b/action-src/main.ts @@ -1,14 +1,18 @@ -import { error, getInput, setFailed, setOutput } from '@actions/core'; +import { error, getInput, getMultilineInput, setFailed, setOutput } from '@actions/core'; import { context } from '@actions/github'; import path from 'path'; import { run as runNode } from '../node-src'; -const maybe = (a: string, b: any = undefined) => { +const maybe = (a: string | string[], b: any = undefined) => { if (!a) { return b; } + if (Array.isArray(a)) { + return a; + } + try { return JSON.parse(a); } catch (e) { @@ -100,15 +104,15 @@ async function run() { const dryRun = getInput('dryRun'); const exitOnceUploaded = getInput('exitOnceUploaded'); const exitZeroOnChanges = getInput('exitZeroOnChanges'); - const externals = getInput('externals'); + const externals = getMultilineInput('externals'); const fileHashing = getInput('fileHashing'); const forceRebuild = getInput('forceRebuild'); const ignoreLastBuildOnBranch = getInput('ignoreLastBuildOnBranch'); const logFile = getInput('logFile'); const only = getInput('only'); const onlyChanged = getInput('onlyChanged'); - const onlyStoryFiles = getInput('onlyStoryFiles'); - const onlyStoryNames = getInput('onlyStoryNames'); + const onlyStoryFiles = getMultilineInput('onlyStoryFiles'); + const onlyStoryNames = getMultilineInput('onlyStoryNames'); const playwright = getInput('playwright'); const preserveMissing = getInput('preserveMissing'); const projectToken = getInput('projectToken') || getInput('appCode'); // backwards compatibility @@ -119,7 +123,7 @@ async function run() { const storybookConfigDir = getInput('storybookConfigDir'); const storybookLogFile = getInput('storybookLogFile'); const traceChanged = getInput('traceChanged'); - const untraced = getInput('untraced'); + const untraced = getMultilineInput('untraced'); const uploadMetadata = getInput('uploadMetadata'); const workingDir = getInput('workingDir') || getInput('workingDirectory'); const zip = getInput('zip');