diff --git a/dist/index.js b/dist/index.js index 88077b7..d46f1b1 100644 --- a/dist/index.js +++ b/dist/index.js @@ -26203,47 +26203,48 @@ function getInputs() { async function run() { try { const inputs = getInputs(); - // await exec.exec('npm install -g @currents/cmd') - // core.saveState('or8n', inputs.or8n) - // if (inputs.or8n) { - // await or8n(inputs) - // return - // } - // const presetOutput = '.currents_env' - // const options: string[] = [ - // `--preset last-run`, - // `--preset-output ${presetOutput}`, - // `--matrix-index ${inputs.matrixIndex}`, - // `--matrix-total ${inputs.matrixTotal}`, - // `--continue` - // ] - // if (inputs.key) { - // options.push(`--key ${inputs.key}`) - // } - // if (inputs.id) { - // options.push(`--id ${inputs.id}`) - // } - // if (inputs.outputDir) { - // options.push(`--output-dir ${inputs.outputDir}`) - // } - // if (inputs.debug) { - // options.push(`--debug`) - // } - // const cacheGetCommand = `npx currents cache get ${options.join(' ')}` - // const exitCode = await exec.exec(cacheGetCommand, [], { - // ignoreReturnCode: true - // }) - // if (exitCode === 0) { - // const extraPwFlags = await exec.getExecOutput(`cat ${presetOutput}`) - // core.setOutput('extra-pw-flags', extraPwFlags.stdout.trim()) - // } - // core.saveState('key', inputs.key) - // core.saveState('debug', inputs.debug) - // core.saveState('id', inputs.id) - // core.saveState('path', inputs.path || '') - // core.saveState('pwOutputDir', inputs.pwOutputDir) - // core.saveState('matrixIndex', inputs.matrixIndex) - // core.saveState('matrixTotal', inputs.matrixTotal) + await exec.exec('npm install -g @currents/cmd'); + core.saveState('or8n', inputs.or8n); + if (inputs.or8n) { + await or8n(inputs); + return; + } + const presetOutput = '.currents_env'; + const options = [ + `--preset last-run`, + `--preset-output ${presetOutput}`, + `--matrix-index ${inputs.matrixIndex}`, + `--matrix-total ${inputs.matrixTotal}`, + `--continue` + ]; + if (inputs.key) { + options.push(`--key ${inputs.key}`); + } + if (inputs.id) { + options.push(`--id ${inputs.id}`); + } + if (inputs.outputDir) { + options.push(`--output-dir ${inputs.outputDir}`); + } + if (inputs.debug) { + options.push(`--debug`); + } + options.push(`--yohay`); + const cacheGetCommand = `npx currents cache get ${options.join(' ')}`; + const exitCode = await exec.exec(cacheGetCommand, [], { + ignoreReturnCode: true + }); + if (exitCode === 0) { + const extraPwFlags = await exec.getExecOutput(`cat ${presetOutput}`); + core.setOutput('extra-pw-flags', extraPwFlags.stdout.trim()); + } + core.saveState('key', inputs.key); + core.saveState('debug', inputs.debug); + core.saveState('id', inputs.id); + core.saveState('path', inputs.path || ''); + core.saveState('pwOutputDir', inputs.pwOutputDir); + core.saveState('matrixIndex', inputs.matrixIndex); + core.saveState('matrixTotal', inputs.matrixTotal); } catch (error) { core.setFailed(error.message); diff --git a/src/index.ts b/src/index.ts index 9327855..66155eb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -41,58 +41,58 @@ async function run(): Promise { try { const inputs = getInputs() - // await exec.exec('npm install -g @currents/cmd') - - // core.saveState('or8n', inputs.or8n) - // if (inputs.or8n) { - // await or8n(inputs) - // return - // } - - // const presetOutput = '.currents_env' - - // const options: string[] = [ - // `--preset last-run`, - // `--preset-output ${presetOutput}`, - // `--matrix-index ${inputs.matrixIndex}`, - // `--matrix-total ${inputs.matrixTotal}`, - // `--continue` - // ] - - // if (inputs.key) { - // options.push(`--key ${inputs.key}`) - // } - - // if (inputs.id) { - // options.push(`--id ${inputs.id}`) - // } - - // if (inputs.outputDir) { - // options.push(`--output-dir ${inputs.outputDir}`) - // } - - // if (inputs.debug) { - // options.push(`--debug`) - // } - - // const cacheGetCommand = `npx currents cache get ${options.join(' ')}` - - // const exitCode = await exec.exec(cacheGetCommand, [], { - // ignoreReturnCode: true - // }) - - // if (exitCode === 0) { - // const extraPwFlags = await exec.getExecOutput(`cat ${presetOutput}`) - // core.setOutput('extra-pw-flags', extraPwFlags.stdout.trim()) - // } - - // core.saveState('key', inputs.key) - // core.saveState('debug', inputs.debug) - // core.saveState('id', inputs.id) - // core.saveState('path', inputs.path || '') - // core.saveState('pwOutputDir', inputs.pwOutputDir) - // core.saveState('matrixIndex', inputs.matrixIndex) - // core.saveState('matrixTotal', inputs.matrixTotal) + await exec.exec('npm install -g @currents/cmd') + + core.saveState('or8n', inputs.or8n) + if (inputs.or8n) { + await or8n(inputs) + return + } + + const presetOutput = '.currents_env' + + const options: string[] = [ + `--preset last-run`, + `--preset-output ${presetOutput}`, + `--matrix-index ${inputs.matrixIndex}`, + `--matrix-total ${inputs.matrixTotal}`, + `--continue` + ] + + if (inputs.key) { + options.push(`--key ${inputs.key}`) + } + + if (inputs.id) { + options.push(`--id ${inputs.id}`) + } + + if (inputs.outputDir) { + options.push(`--output-dir ${inputs.outputDir}`) + } + + if (inputs.debug) { + options.push(`--debug`) + } + options.push(`--yohay`) + const cacheGetCommand = `npx currents cache get ${options.join(' ')}` + + const exitCode = await exec.exec(cacheGetCommand, [], { + ignoreReturnCode: true + }) + + if (exitCode === 0) { + const extraPwFlags = await exec.getExecOutput(`cat ${presetOutput}`) + core.setOutput('extra-pw-flags', extraPwFlags.stdout.trim()) + } + + core.saveState('key', inputs.key) + core.saveState('debug', inputs.debug) + core.saveState('id', inputs.id) + core.saveState('path', inputs.path || '') + core.saveState('pwOutputDir', inputs.pwOutputDir) + core.saveState('matrixIndex', inputs.matrixIndex) + core.saveState('matrixTotal', inputs.matrixTotal) } catch (error) { core.setFailed((error as Error).message) }