mirror of
https://github.com/dawidd6/action-ansible-playbook.git
synced 2024-12-23 04:37:29 +00:00
Capture output of stdout and stderr to Actions
This commit is contained in:
parent
fbcc2c2bae
commit
d82d4c8f2c
2 changed files with 16 additions and 1 deletions
|
@ -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
|
||||
|
|
12
main.js
12
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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue