Skip to content

Commit

Permalink
set output
Browse files Browse the repository at this point in the history
  • Loading branch information
thypon committed May 24, 2024
1 parent eae3be8 commit 116a29e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions action.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 116a29e

Please sign in to comment.