Add check mode and fixes boolean inputs (#111)

* Add check mode option

* Fixes boolean inputs

Boolean inputs weren't working properly before. Passing any value would
result in `true`, which is unexpected and not according to inputs
description. This change retrieves booleans with `getBooleanInput()` and
sets a default to `false`.

Relevant GitHub discussion and comment: https://github.com/actions/toolkit/issues/361#issuecomment-829507270

* Update action.yml

* Update test.yml

* Update test.yml

---------

Co-authored-by: Dawid Dziurla <dawidd0811@gmail.com>
This commit is contained in:
Alex van den Hoogen
2025-02-10 18:11:33 +01:00
committed by GitHub
parent 245b181622
commit a4d1256d3c
3 changed files with 21 additions and 3 deletions

View File

@@ -15,8 +15,9 @@ async function main() {
const vaultPassword = core.getInput("vault_password")
const knownHosts = core.getInput("known_hosts")
const options = core.getInput("options")
const sudo = core.getInput("sudo")
const noColor = core.getInput("no_color")
const sudo = core.getBooleanInput("sudo")
const noColor = core.getBooleanInput("no_color")
const checkMode = core.getBooleanInput("check_mode")
const fileMode = 0600
let cmd = ["ansible-playbook", playbook]
@@ -94,6 +95,10 @@ async function main() {
process.env.ANSIBLE_FORCE_COLOR = "True"
}
if (checkMode) {
cmd.push("--check")
}
let output = ""
await exec.exec(cmd.join(' '), null, {
listeners: {