diff --git a/action.cjs b/action.cjs index aa6e61b7..5722305d 100644 --- a/action.cjs +++ b/action.cjs @@ -29,6 +29,16 @@ 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()) + 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 +77,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 +125,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