mirror of
https://github.com/dawidd6/action-ansible-playbook.git
synced 2024-12-28 11:06:09 -07:00
Capture output of stdout and stderr to Actions
This commit is contained in:
parent
fbcc2c2bae
commit
d82d4c8f2c
|
@ -31,6 +31,11 @@ inputs:
|
||||||
sudo:
|
sudo:
|
||||||
description: Set to "true" if root is required for running your playbook
|
description: Set to "true" if root is required for running your playbook
|
||||||
required: false
|
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:
|
runs:
|
||||||
using: node12
|
using: node12
|
||||||
main: main.js
|
main: main.js
|
||||||
|
|
12
main.js
12
main.js
|
@ -81,7 +81,17 @@ async function main() {
|
||||||
|
|
||||||
process.env.ANSIBLE_FORCE_COLOR = "True"
|
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) {
|
} catch (error) {
|
||||||
core.setFailed(error.message)
|
core.setFailed(error.message)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user