Skip to content

Commit

Permalink
Add "config" and "fix" inputs, deprecate "command" input.
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidAnson committed Jun 12, 2023
1 parent 8597858 commit f70c069
Show file tree
Hide file tree
Showing 8 changed files with 734 additions and 542 deletions.
2 changes: 2 additions & 0 deletions .github/dictionary.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
CommonMark
config
markdownlint-cli2-action
README
truthy
40 changes: 39 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- run: exit 1
if: steps.test.outcome != 'failure'
one-glob-pattern:
name: One glob (*.md, 0 errors)
name: One glob (README.md, 0 errors)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -72,6 +72,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: rm .markdownlint.json
- uses: ./
with:
command: config
Expand Down Expand Up @@ -117,6 +118,7 @@ jobs:
- uses: ./
with:
command: fix
globs: 'test/*'
command-unsupported:
name: Command = unsupported (fails)
runs-on: ubuntu-latest
Expand All @@ -129,3 +131,39 @@ jobs:
id: test
- run: exit 1
if: steps.test.outcome != 'failure'
config:
name: config (test/errors.md, 2 errors)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: rm .markdownlint.json
- uses: ./
with:
config: 'config/test.markdownlint.jsonc'
globs: 'test/*'
continue-on-error: true
id: test
- run: exit 1
if: steps.test.outcome != 'failure'
config-invalid:
name: config (invalid configuration file, fails)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./
with:
config: 'invalid.markdownlint.jsonc'
globs: 'test/*'
continue-on-error: true
id: test
- run: exit 1
if: steps.test.outcome != 'failure'
fix:
name: fix (test/errors.md, 0 errors)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./
with:
fix: true
globs: 'test/*'
37 changes: 25 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,32 @@ information.

### command (optional)

Command to run (unset, `fix`, or `config`)
> **Deprecated in favor of the "fix" and "config" inputs**
>
> Command to run (unset, `fix`, or `config`)
>
> If unspecified or `""`, the `markdownlint-cli2` command is run.
>
> If set to `fix`, the `markdownlint-cli2-fix` command is run and supported
> issues will be fixed automatically.
>
> If set to `config`, the `markdownlint-cli2-config` command is run and the
> first element of `globs` should specify a supported configuration file.
>
> For more detail: [documentation for `markdownlint-cli2`][command-line].
If unspecified or `""`, the `markdownlint-cli2` command is run.
### config (optional)

If set to `fix`, the `markdownlint-cli2-fix` command is run and supported issues
will be fixed automatically.
Path of a file to use for the base configuration object (defaults to none)

If set to `config`, the `markdownlint-cli2-config` command is run and the first
element of `globs` should specify a supported configuration file.
Equivalent to using the `--config` [command-line option][command-line] and
passing the specified configuration file.

For more detail: [documentation for `markdownlint-cli2`][command-line].
### fix (optional)

Whether to fix supported issues automatically (any truthy value enables)

Equivalent to specifying the `--fix` [command-line option][command-line].

### globs (optional)

Expand Down Expand Up @@ -88,7 +103,7 @@ To fix supported issues when linting:
```yaml
- uses: DavidAnson/markdownlint-cli2-action@v10
with:
command: fix
fix: true
globs: '**/*.md'
```
Expand All @@ -97,10 +112,8 @@ To specify a custom configuration file:
```yaml
- uses: DavidAnson/markdownlint-cli2-action@v10
with:
command: config
globs: |
config/custom.markdownlint.jsonc
**/*.md
config: 'config/custom.markdownlint.jsonc'
globs: '**/*.md'
```
To prevent linting issues from failing the workflow run:
Expand Down
9 changes: 9 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ branding:
inputs:
command:
description: Command to run (unset, "fix", or "config")
deprecationMessage: This input is deprecated in favor of the "fix" and "config" inputs
default: ''
required: false
config:
description: Path of a file to use for the base configuration object (defaults to none)
default: ''
required: false
fix:
description: Whether to fix supported issues automatically (any truthy value enables)
default: ''
required: false
globs:
Expand Down
18 changes: 0 additions & 18 deletions config/.markdownlint.jsonc

This file was deleted.

Loading

0 comments on commit f70c069

Please sign in to comment.