0
0
Fork 0
mirror of https://github.com/DavidAnson/markdownlint-cli2-action.git synced 2024-12-22 04:43:32 +01:00

Add "separator" input to enable using something other than "\n" for the globs input (fixes #58).

This commit is contained in:
David Anson 2022-11-30 03:29:42 +00:00
parent ee28a92f8a
commit 9085e7e0dc
6 changed files with 42 additions and 4 deletions

View file

@ -11,8 +11,9 @@ jobs:
id: changed-files
with:
files: '**/*.md'
separator: "\n"
separator: ","
- uses: DavidAnson/markdownlint-cli2-action@v7
if: steps.changed-files.outputs.any_changed == 'true'
with:
globs: ${{ steps.changed-files.outputs.all_changed_files }}
separator: ","

View file

@ -54,6 +54,19 @@ jobs:
id: test
- run: exit 1
if: steps.test.outcome != 'failure'
separator:
name: Separator (README.md and test/errors.md, 3 errors)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./
with:
globs: '*.md,test/*'
separator: ','
continue-on-error: true
id: test
- run: exit 1
if: steps.test.outcome != 'failure'
command-config:
name: Command = config (test/errors.md, 2 errors)
runs-on: ubuntu-latest

View file

@ -29,13 +29,20 @@ For more detail: [documentation for `markdownlint-cli2`][command-line].
### globs (optional)
Glob expression(s) of files to lint (newline-delimited)
Glob expression(s) of files to lint (newline-delimited by default)
The default `*.{md,markdown}` lints all Markdown files in the base directory
of a project.
For more detail: [glob syntax in `markdownlint-cli2`][glob-syntax].
### separator (optional)
String to use as a separator for the `globs` input (defaults to newline)
Allows the `globs` input to use something other than `\n` to separate glob
expressions.
## Outputs
[None]
@ -67,6 +74,15 @@ To lint specific Markdown files in a project:
docs/*.md
```
To use a custom separator:
```yaml
- uses: DavidAnson/markdownlint-cli2-action@v7
with:
globs: 'README.md,CHANGELOG.md,docs/*.md'
separator: ','
```
To fix supported issues when linting:
```yaml

View file

@ -13,6 +13,10 @@ inputs:
description: Glob expression(s) of files to lint (newline-delimited)
default: '*.{md,markdown}'
required: false
separator:
description: String to use as a separator for the "globs" input (defaults to newline)
default: "\n"
required: false
runs:
using: node16
main: dist/index.js

4
dist/index.js vendored
View file

@ -34498,9 +34498,11 @@ const logError = (error) => {
}
core.error(error, annotation);
};
const separator = core.getInput("separator") || "\n";
const argv =
core.getInput("globs").
split("\n").
split(separator).
filter(String);
const parameters = {

View file

@ -32,9 +32,11 @@ const logError = (error) => {
}
core.error(error, annotation);
};
const separator = core.getInput("separator") || "\n";
const argv =
core.getInput("globs").
split("\n").
split(separator).
filter(String);
const parameters = {