diff --git a/action.yaml b/action.yaml index 74aadcb..b610af2 100644 --- a/action.yaml +++ b/action.yaml @@ -48,6 +48,11 @@ inputs: default: '' description: Path to local Deployer binary. + recipe: + required: false + default: '' + description: Recipe file path. + ansi: required: false default: 'true' @@ -59,7 +64,7 @@ inputs: description: Verbosity level Can be -v, -vv or -vvv. runs: - using: 'node16' + using: 'node20' main: 'index.js' branding: diff --git a/index.js b/index.js index f39cc9d..ac1c903 100644 --- a/index.js +++ b/index.js @@ -95,7 +95,7 @@ async function dep() { } } if (typeof url === 'undefined') { - throw new Error(`The version "${version}"" does not exist in the "https://deployer.org/manifest.json" file."`) + core.setFailed(`The version "${version}"" does not exist in the "https://deployer.org/manifest.json" file."`) } else { console.log(`Downloading "${url}".`) await $`curl -LO ${url}` @@ -106,24 +106,26 @@ async function dep() { } let cmd = core.getInput('dep').split(' ') + let recipe = core.getInput('recipe') + if (recipe !== '') { + recipe = `--file=${recipe}` + } + let ansi = core.getBooleanInput('ansi') ? '--ansi' : '--no-ansi' let verbosity = core.getInput('verbosity') let options = [] - let optionsInput = core.getInput('options'); - - if (optionsInput !== '') { - try { - for (let [key, value] in Object.entries(JSON.parse(optionsInput))) { + try { + let optionsArg = core.getInput('options') + if (optionsArg !== '') { + for (let [key, value] in Object.entries(JSON.parse(optionsArg))) { options.push('-o', `${key}=${value}`) } - } catch (e) { - throw new Error('Invalid JSON in options') } } try { - await $`php ${dep} ${cmd} --no-interaction ${ansi} ${verbosity} ${options}` + await $`php ${dep} ${cmd} ${recipe} --no-interaction ${ansi} ${verbosity} ${options}` } catch (err) { - throw new Error(`Failed: dep ${cmd}`) + core.setFailed(`Failed: dep ${cmd}`) } }