diff --git a/action.yml b/action.yml index c35442d..b11eac6 100644 --- a/action.yml +++ b/action.yml @@ -31,6 +31,11 @@ inputs: sudo: description: Set to "true" if root is required for running your playbook required: false +outputs: + stdout: + description: The captured output of stdout from the Ansible Playbook run + stderr: + description: The captured output of stderr from the Ansible Playbook run runs: using: node12 main: main.js diff --git a/main.js b/main.js index 81e200b..fefb308 100644 --- a/main.js +++ b/main.js @@ -81,7 +81,17 @@ async function main() { process.env.ANSIBLE_FORCE_COLOR = "True" - await exec.exec(cmd.join(' ')) + const execOptions = {}; + execOptions.listeners = { + stdout: (data: Buffer) => { + core.setOutput('stdout', data.toString()); + }, + stderr: (data: Buffer) => { + core.setOutput('stderr', data.toString()); + } + }; + + await exec.exec(cmd.join(' '), execOptions) } catch (error) { core.setFailed(error.message) }