diff --git a/dist/post_run/index.js b/dist/post_run/index.js index 8d68dae..973c3d3 100644 --- a/dist/post_run/index.js +++ b/dist/post_run/index.js @@ -90897,12 +90897,27 @@ async function prepareEnv() { core.info(`Prepared env in ${Date.now() - startedAt}ms`); return { lintPath, patchPath }; } +const printOutputAndForwardJSON = (s) => { + const lines = s.split(`\n`).filter((line) => line.length > 0); + for (const line of lines) { + if (line.startsWith(`::`)) { + core.info(line); + } + try { + const obj = JSON.parse(line); + core.setOutput("JSON", JSON.stringify(obj, null, 2)); + } + catch (err) { + core.info(line); + } + } +}; const printOutput = (res) => { if (res.stdout) { - core.info(res.stdout); + printOutputAndForwardJSON(res.stdout); } if (res.stderr) { - core.info(res.stderr); + printOutputAndForwardJSON(res.stderr); } }; async function runLint(lintPath, patchPath) { @@ -90926,8 +90941,9 @@ async function runLint(lintPath, patchPath) { .trim() .split(",") .filter((f) => f.length > 0) - .filter((f) => !f.startsWith(`github-actions`)) + .filter((f) => !f.startsWith(`github-actions`) && !f.startsWith(`json`)) .concat("github-actions") + .concat("json") .join(","); addedArgs.push(`--out-format=${formats}`); userArgs = userArgs.replace(/--out-format=\S*/gi, "").trim(); diff --git a/dist/run/index.js b/dist/run/index.js index 8ba3171..516bf7d 100644 --- a/dist/run/index.js +++ b/dist/run/index.js @@ -90897,12 +90897,27 @@ async function prepareEnv() { core.info(`Prepared env in ${Date.now() - startedAt}ms`); return { lintPath, patchPath }; } +const printOutputAndForwardJSON = (s) => { + const lines = s.split(`\n`).filter((line) => line.length > 0); + for (const line of lines) { + if (line.startsWith(`::`)) { + core.info(line); + } + try { + const obj = JSON.parse(line); + core.setOutput("JSON", JSON.stringify(obj, null, 2)); + } + catch (err) { + core.info(line); + } + } +}; const printOutput = (res) => { if (res.stdout) { - core.info(res.stdout); + printOutputAndForwardJSON(res.stdout); } if (res.stderr) { - core.info(res.stderr); + printOutputAndForwardJSON(res.stderr); } }; async function runLint(lintPath, patchPath) { @@ -90926,8 +90941,9 @@ async function runLint(lintPath, patchPath) { .trim() .split(",") .filter((f) => f.length > 0) - .filter((f) => !f.startsWith(`github-actions`)) + .filter((f) => !f.startsWith(`github-actions`) && !f.startsWith(`json`)) .concat("github-actions") + .concat("json") .join(","); addedArgs.push(`--out-format=${formats}`); userArgs = userArgs.replace(/--out-format=\S*/gi, "").trim(); diff --git a/src/run.ts b/src/run.ts index 3e019bf..6ed1728 100644 --- a/src/run.ts +++ b/src/run.ts @@ -103,7 +103,7 @@ type ExecRes = { stderr: string } -const printJSONLines = (s: string): void => { +const printOutputAndForwardJSON = (s: string): void => { const lines = s.split(`\n`).filter((line) => line.length > 0) for (const line of lines) { if (line.startsWith(`::`)) { @@ -112,7 +112,7 @@ const printJSONLines = (s: string): void => { try { const obj = JSON.parse(line) - core.setOutput('json', JSON.stringify(obj, null, 2)) + core.setOutput("JSON", JSON.stringify(obj, null, 2)) } catch (err) { core.info(line) } @@ -121,10 +121,10 @@ const printJSONLines = (s: string): void => { const printOutput = (res: ExecRes): void => { if (res.stdout) { - printJSONLines(res.stdout) + printOutputAndForwardJSON(res.stdout) } if (res.stderr) { - printJSONLines(res.stderr) + printOutputAndForwardJSON(res.stderr) } }