mirror of
https://github.com/DavidAnson/markdownlint-cli2-action.git
synced 2024-11-21 22:01:30 +01:00
Add "separator" input to enable using something other than "\n" for the globs input (fixes #58).
This commit is contained in:
parent
ee28a92f8a
commit
9085e7e0dc
6 changed files with 42 additions and 4 deletions
3
.github/workflows/changed.yml
vendored
3
.github/workflows/changed.yml
vendored
|
@ -11,8 +11,9 @@ jobs:
|
||||||
id: changed-files
|
id: changed-files
|
||||||
with:
|
with:
|
||||||
files: '**/*.md'
|
files: '**/*.md'
|
||||||
separator: "\n"
|
separator: ","
|
||||||
- uses: DavidAnson/markdownlint-cli2-action@v7
|
- uses: DavidAnson/markdownlint-cli2-action@v7
|
||||||
if: steps.changed-files.outputs.any_changed == 'true'
|
if: steps.changed-files.outputs.any_changed == 'true'
|
||||||
with:
|
with:
|
||||||
globs: ${{ steps.changed-files.outputs.all_changed_files }}
|
globs: ${{ steps.changed-files.outputs.all_changed_files }}
|
||||||
|
separator: ","
|
||||||
|
|
13
.github/workflows/test.yml
vendored
13
.github/workflows/test.yml
vendored
|
@ -54,6 +54,19 @@ jobs:
|
||||||
id: test
|
id: test
|
||||||
- run: exit 1
|
- run: exit 1
|
||||||
if: steps.test.outcome != 'failure'
|
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:
|
command-config:
|
||||||
name: Command = config (test/errors.md, 2 errors)
|
name: Command = config (test/errors.md, 2 errors)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
18
README.md
18
README.md
|
@ -29,13 +29,20 @@ For more detail: [documentation for `markdownlint-cli2`][command-line].
|
||||||
|
|
||||||
### globs (optional)
|
### 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
|
The default `*.{md,markdown}` lints all Markdown files in the base directory
|
||||||
of a project.
|
of a project.
|
||||||
|
|
||||||
For more detail: [glob syntax in `markdownlint-cli2`][glob-syntax].
|
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
|
## Outputs
|
||||||
|
|
||||||
[None]
|
[None]
|
||||||
|
@ -67,6 +74,15 @@ To lint specific Markdown files in a project:
|
||||||
docs/*.md
|
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:
|
To fix supported issues when linting:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
|
|
@ -13,6 +13,10 @@ inputs:
|
||||||
description: Glob expression(s) of files to lint (newline-delimited)
|
description: Glob expression(s) of files to lint (newline-delimited)
|
||||||
default: '*.{md,markdown}'
|
default: '*.{md,markdown}'
|
||||||
required: false
|
required: false
|
||||||
|
separator:
|
||||||
|
description: String to use as a separator for the "globs" input (defaults to newline)
|
||||||
|
default: "\n"
|
||||||
|
required: false
|
||||||
runs:
|
runs:
|
||||||
using: node16
|
using: node16
|
||||||
main: dist/index.js
|
main: dist/index.js
|
||||||
|
|
4
dist/index.js
vendored
4
dist/index.js
vendored
|
@ -34498,9 +34498,11 @@ const logError = (error) => {
|
||||||
}
|
}
|
||||||
core.error(error, annotation);
|
core.error(error, annotation);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const separator = core.getInput("separator") || "\n";
|
||||||
const argv =
|
const argv =
|
||||||
core.getInput("globs").
|
core.getInput("globs").
|
||||||
split("\n").
|
split(separator).
|
||||||
filter(String);
|
filter(String);
|
||||||
|
|
||||||
const parameters = {
|
const parameters = {
|
||||||
|
|
|
@ -32,9 +32,11 @@ const logError = (error) => {
|
||||||
}
|
}
|
||||||
core.error(error, annotation);
|
core.error(error, annotation);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const separator = core.getInput("separator") || "\n";
|
||||||
const argv =
|
const argv =
|
||||||
core.getInput("globs").
|
core.getInput("globs").
|
||||||
split("\n").
|
split(separator).
|
||||||
filter(String);
|
filter(String);
|
||||||
|
|
||||||
const parameters = {
|
const parameters = {
|
||||||
|
|
Loading…
Reference in a new issue