Skip to content

Commit 58c8341

Browse files
authored
fix: check if options were passed as arguments (#68)
before needlessly printing an error in the console, as an empty string is an invalid JSON string.
1 parent 363bb1b commit 58c8341

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

index.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,15 @@ async function dep() {
110110
let verbosity = core.getInput('verbosity')
111111
let options = []
112112
try {
113-
for (let [key, value] in Object.entries(JSON.parse(core.getInput('options')))) {
114-
options.push('-o', `${key}=${value}`)
113+
let optionsArg = core.getInput('options')
114+
if (optionsArg !== '') {
115+
for (let [key, value] in Object.entries(JSON.parse(optionsArg))) {
116+
options.push('-o', `${key}=${value}`)
117+
}
118+
} catch (e) {
119+
console.error('Invalid JSON in options')
120+
}
115121
}
116-
} catch (e) {
117-
console.error('Invalid JSON in options')
118-
}
119122

120123
try {
121124
await $`php ${dep} ${cmd} --no-interaction ${ansi} ${verbosity} ${options}`

0 commit comments

Comments
 (0)