From 116a29ea69c6eefcf00ad8d2b8465cbabe0bce05 Mon Sep 17 00:00:00 2001 From: Andrea Brancaleoni Date: Sat, 25 May 2024 00:31:30 +0200 Subject: [PATCH] set output --- action.cjs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/action.cjs b/action.cjs index aa6e61b7..2e43634a 100644 --- a/action.cjs +++ b/action.cjs @@ -29,6 +29,18 @@ function runCommand () { }) } +function setOutput (core) { + // read file contained in GITHUB_OUTPUT + fs.readFileSync(process.env.GITHUB_OUTPUT, 'utf8') + .split('\n') + .forEach(line => { + const [key, value] = line.split('=').map(e => e.trim()) + if (key && value) { + core.setOutput(key, value) + } + }) +} + module.exports = async ({ github, context, inputs, actionPath, core }) => { // const debug = inputs.debug === 'true' ? console.log : () => {} const debug = console.log @@ -67,6 +79,7 @@ module.exports = async ({ github, context, inputs, actionPath, core }) => { const env = { ...process.env } delete env.GITHUB_BASE_REF await runCommand(`${actionPath}/assets/reviewdog.sh`, { env }) + setOutput(core) debug('Reviewdog full step completed') } @@ -114,6 +127,7 @@ module.exports = async ({ github, context, inputs, actionPath, core }) => { PYPI_INSECURE_HOSTS: inputs.pip_audit_pypi_insecure_hosts } await runCommand(`${actionPath}/assets/reviewdog.sh`, { env }) + setOutput(core) debug('Reviewdog PR step completed') // comments-after step