Skip to content

Commit e41974b

Browse files
committed
Rename some inputs, add disable, dot, and enable
1 parent b4d5756 commit e41974b

4 files changed

Lines changed: 73 additions & 28 deletions

File tree

.github/workflows/ci.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ jobs:
3232
id: expect-failure
3333
uses: ./
3434
with:
35-
config_file: .markdownlintrc
35+
config: .markdownlintrc
36+
dot: true
3637
files: .
3738
rules: examples/rules/custom.js
3839
continue-on-error: true
@@ -42,14 +43,14 @@ jobs:
4243
- name: Test ignore_files
4344
uses: ./
4445
with:
45-
config_file: .markdownlintrc
46+
config: .markdownlintrc
4647
files: .
47-
ignore_files: examples/ignore/*
48+
ignore: examples/ignore/*
4849
rules: examples/rules/custom.js
4950
- name: Test ignore_path
5051
uses: ./
5152
with:
52-
config_file: .markdownlintrc
53+
config: .markdownlintrc
5354
files: .
54-
ignore_path: examples/.markdownlintignore
55+
ignore-path: examples/.markdownlintignore
5556
rules: examples/rules/custom.js

README.md

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,37 @@ A GitHub Action that performs style checking and linting for Markdown/CommonMark
1010
Basic usage with all options enabled:
1111

1212
```yaml
13-
14-
- name: markdownlint-cli
15-
uses: nosborn/github-action-markdown-cli@v3.0.1
16-
with:
17-
files: .
18-
config_file: .markdownlint.yaml
19-
ignore_files: examples/ignore/*
20-
ignore_path: examples/.markdownlintignore
21-
rules: examples/rules/custom.js
22-
13+
- name: markdownlint-cli
14+
uses: nosborn/github-action-markdown-cli@v4.0.0
15+
with:
16+
files: .
17+
config-file: .markdownlint.yaml
18+
disable: MD013 MD041
19+
dot: true
20+
enable: MD013 MD041
21+
ignore: examples/ignore/*
22+
ignore-path: examples/.markdownlintignore
23+
rules: examples/rules/custom.js
2324
```
2425
2526
## Inputs
2627
27-
* `files` - what to process (files, directories, globs)
28-
* `config_file` (optional) - configuration file (JSON or YAML)
29-
* `ignore_files` (optional) - files to ignore/exclude (file, directory, glob)
30-
* `ignore_path` (optional) - path to file with ignore pattern(s)
31-
* `rules` (optional) - custom rule files (file, directory, glob, package)
28+
- `files` - what to process (files, directories, globs)
29+
- `config` (optional) - configuration file (JSON or YAML)
30+
- `disable` (optional) - disable certain rules, for example `MD013 MD041`
31+
- `dot` (optional) - if `true`, include files/folders with a dot (for example `.github`)
32+
- `enable` (optional) - enable certain rules, for example `MD013 MD041`
33+
- `ignore` (optional) - files to ignore/exclude (file, directory, glob)
34+
- `ignore-path` (optional) - path to file with ignore patterns
35+
- `rules` (optional) - custom rule files (file, directory, glob, package)
36+
37+
### Deprecated inputs
38+
39+
These inputs are still available but will be removed in a future major version.
40+
41+
- `config_file` (optional) - configuration file (JSON or YAML) - superseded by `config`
42+
- `ignore_files` (optional) - files to ignore/exclude (file, directory, glob) - superseded by `ignore`
43+
- `ignore_path` (optional) - path to file with ignore patterns - superseded by `ignore-path`
3244

3345
## License
3446

action.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,40 @@ author: Nick Osborn
44
description: Style checker and lint tool for Markdown/CommonMark files.
55

66
inputs:
7+
config:
8+
description: configuration file (JSON or YAML)
9+
required: false
710
config_file:
811
description: configuration file (JSON or YAML)
912
required: false
13+
deprecationMessage: Please use 'config' instead.
14+
disable:
15+
description: enable certain rules, for example 'MD013 MD041'
16+
required: false
17+
dot:
18+
description: >
19+
if 'true', include files/folders with a dot (for example '.github')
20+
required: false
21+
enable:
22+
description: enable certain rules, for example 'MD013 MD041'
23+
required: false
1024
files:
1125
description: files, directories, or globs
1226
required: true
27+
ignore:
28+
description: files to ignore/exclude
29+
required: false
30+
ignore-path:
31+
description: path to file with ignore pattern(s)
32+
required: false
1333
ignore_files:
1434
description: files to ignore/exclude
1535
required: false
36+
deprecationMessage: Please use 'ignore' instead.
1637
ignore_path:
1738
description: path to file with ignore pattern(s)
1839
required: false
40+
deprecationMessage: Please use 'ignore-path' instead.
1941
rules:
2042
description: custom rule files
2143
required: false

entrypoint.sh

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
11
#!/bin/sh
22

3+
env | sort -u
4+
5+
set -eu
6+
37
MARKDOWNLINT=markdownlint
4-
MARKDOWNLINT="${MARKDOWNLINT}${INPUT_CONFIG_FILE:+ -c ${INPUT_CONFIG_FILE}}"
5-
MARKDOWNLINT="${MARKDOWNLINT}${INPUT_IGNORE_FILES:+ -i ${INPUT_IGNORE_FILES}}"
6-
MARKDOWNLINT="${MARKDOWNLINT}${INPUT_IGNORE_PATH:+ -p ${INPUT_IGNORE_PATH}}"
7-
MARKDOWNLINT="${MARKDOWNLINT}${INPUT_RULES:+ -r ${INPUT_RULES}}"
8+
MARKDOWNLINT="${MARKDOWNLINT}${INPUT_CONFIG:+ -c ${INPUT_CONFIG:?}}"
9+
MARKDOWNLINT="${MARKDOWNLINT}${INPUT_DISABLE:+ --disable ${INPUT_DISABLE:?}}"
10+
# shellcheck disable=SC2312
11+
if [ "$(echo "${INPUT_DOT:-false}" | tr '[:upper:]' '[:lower:]')" = true ]; then
12+
MARKDOWNLINT="${MARKDOWNLINT} --dot"
13+
fi
14+
MARKDOWNLINT="${MARKDOWNLINT}${INPUT_ENABLE:+ --enable ${INPUT_ENABLE:?}}"
15+
MARKDOWNLINT="${MARKDOWNLINT}${INPUT_IGNORE:+ -i ${INPUT_IGNORE:?}}"
16+
MARKDOWNLINT="${MARKDOWNLINT}${INPUT_IGNORE_PATH:+ -p ${INPUT_IGNORE_PATH:?}}"
17+
MARKDOWNLINT="${MARKDOWNLINT}${INPUT_RULES:+ -r ${INPUT_RULES:?}}"
818

9-
PROBLEM_MATCHER="$(mktemp -p "${GITHUB_WORKSPACE}")"
19+
PROBLEM_MATCHER="$(mktemp -p "${GITHUB_WORKSPACE:?}")"
1020
trap 'rm -f "${PROBLEM_MATCHER}"' EXIT
1121
cp /markdownlint-problem-matcher.json "${PROBLEM_MATCHER:?}" || exit
1222
echo "::add-matcher::${PROBLEM_MATCHER:?}"
1323

24+
printf 'Constructed %s\n' "${MARKDOWNLINT}" >&2
1425
# shellcheck disable=SC2086
15-
${MARKDOWNLINT} ${INPUT_FILES}
16-
readonly RC=$?
26+
${MARKDOWNLINT} ${INPUT_FILES:?} || readonly rc=$?
1727

1828
echo '::remove-matcher owner=markdownlint::'
1929

20-
exit ${RC}
30+
exit "${rc:-0}"

0 commit comments

Comments
 (0)