From c643cd59b939bc5bba20cd19fb713d82c3a828ee Mon Sep 17 00:00:00 2001 From: David Anson Date: Sat, 16 May 2026 17:33:08 -0700 Subject: [PATCH] Treat "fix" input as a boolean via getBooleanInput, update documentation (refs #366). --- .github/workflows/test.yml | 17 +++++++++++++++-- README.md | 9 +++++---- action.yml | 6 +++--- dist/index.mjs | 2 +- markdownlint-cli2-action.mjs | 2 +- 5 files changed, 25 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index abf5c54..5c03aed 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -126,8 +126,8 @@ jobs: id: test - run: exit 1 if: steps.test.outcome != 'failure' - fix: - name: fix (test/errors.md, 0 errors) + fix-true: + name: fix-true (test/errors.md, 0 errors) runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 @@ -135,6 +135,19 @@ jobs: with: fix: true globs: 'test/*.md' + fix-false: + name: fix-false (test/errors.md, 3 errors) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: ./ + with: + fix: false + globs: 'test/*.md' + continue-on-error: true + id: test + - run: exit 1 + if: steps.test.outcome != 'failure' rules-pass: name: custom rules (README.md, 0 errors) runs-on: ubuntu-latest diff --git a/README.md b/README.md index a26bd2f..3ffab96 100644 --- a/README.md +++ b/README.md @@ -30,16 +30,17 @@ and passing the specified JSON Pointer. ### fix (optional) -Whether to fix supported issues automatically (any truthy value enables) +Whether to fix supported issues automatically (`true`/`false`, defaults to +`false`) Equivalent to specifying the `--fix` [command-line option][command-line]. ### globs (optional) -Glob expression(s) of files to lint (newline-delimited by default) +Glob expression(s) of files to lint (newline-delimited, defaults to +`*.{md,markdown}`) -The default `*.{md,markdown}` lints all Markdown files in the base directory of -a project. +The default lints all Markdown files in the base directory of a project. For more detail: [glob syntax in `markdownlint-cli2`][glob-syntax]. diff --git a/action.yml b/action.yml index 026e5ac..2a7e47a 100644 --- a/action.yml +++ b/action.yml @@ -14,11 +14,11 @@ inputs: default: '' required: false fix: - description: Whether to fix supported issues automatically (any truthy value enables) - default: '' + description: Whether to fix supported issues automatically ("true"/"false", defaults to "false") + default: 'false' required: false globs: - description: Glob expression(s) of files to lint (newline-delimited) + description: Glob expression(s) of files to lint (newline-delimited, defaults to "*.{md,markdown}") default: '*.{md,markdown}' required: false separator: diff --git a/dist/index.mjs b/dist/index.mjs index 8ea7000..2851f04 100644 --- a/dist/index.mjs +++ b/dist/index.mjs @@ -81159,7 +81159,7 @@ const configPointer = getInput("configPointer"); if (configPointer) { argv.push("--configPointer", configPointer); } -const fix = Boolean(getInput("fix")); +const fix = Boolean(getBooleanInput("fix")); if (fix) { argv.push("--fix"); } diff --git a/markdownlint-cli2-action.mjs b/markdownlint-cli2-action.mjs index c062da5..6dc26a6 100644 --- a/markdownlint-cli2-action.mjs +++ b/markdownlint-cli2-action.mjs @@ -58,7 +58,7 @@ const configPointer = core.getInput("configPointer"); if (configPointer) { argv.push("--configPointer", configPointer); } -const fix = Boolean(core.getInput("fix")); +const fix = Boolean(core.getBooleanInput("fix")); if (fix) { argv.push("--fix"); }