Skip to content

Commit d99c148

Browse files
authored
Lint all markdown files in CI (#4402)
## Motivation linkerd/rfc#22 ## Solution Use the [markdown-lint-action](https://github.com/marketplace/actions/markdown-linting-action) to lint all `.md` files for all pull requests and pushes to master. This action uses the default rules outlined in [markdownlint package](https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md). The additional rules are added are explained below: - Ignore line length lints for code blocks - Ignore line length lints for tables - Allow duplicate sub-headers in sibling headers (e.g. allowing multiple ## Significant headers in `CHANGES.md` as long as they are part of separate release headers) Signed-off-by: Kevin Leimkuhler <kevin@kleimkuhler.com>
1 parent 30ba9a1 commit d99c148

File tree

5 files changed

+41
-0
lines changed

5 files changed

+41
-0
lines changed

.github/workflows/static_checks.yml

+9
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,12 @@ jobs:
8888
! -name *.nuspec \
8989
! -name *.ps1 \
9090
| xargs -I {} bin/shellcheck -x -P ./bin {}
91+
markdown_lint:
92+
name: Markdown lint
93+
runs-on: ubuntu-18.04
94+
steps:
95+
- name: Checkout code
96+
# actions/checkout@v2
97+
uses: actions/checkout@722adc6
98+
- name: Markdown lint
99+
run: bin/markdownlint-all

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ web/app/yarn-error.log
1313
**/*.gogen*
1414
**/*.swp
1515
charts/**/charts
16+
package-lock.json

.markdownlint.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
default: true
2+
line_length:
3+
code_blocks: false
4+
tables: false
5+
headings:
6+
siblings_only: true

bin/markdownlint

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
set -eu
4+
5+
bindir=$( cd "${BASH_SOURCE[0]%/*}" && pwd )
6+
rootdir=$( cd "$bindir"/.. && pwd )
7+
markdownlintbin="$rootdir/node_modules/.bin/markdownlint"
8+
9+
markdownlint_version=0.23.1
10+
11+
if [ ! -x "$markdownlintbin" ] || [ "$($markdownlintbin -V)" != $markdownlint_version ]; then
12+
if ! [ -x "$(command -v npm)" ]; then
13+
echo "Error: npm required to install markdownlint command"
14+
exit 1
15+
fi
16+
npm install markdownlint-cli@$markdownlint_version
17+
fi
18+
19+
"$markdownlintbin" "$@"

bin/markdownlint-all

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
bindir=$( cd "${BASH_SOURCE[0]%/*}" && pwd )
4+
5+
"$bindir"/markdownlint ./*.md
6+
"$bindir"/markdownlint ./**/*.md --ignore node_modules/

0 commit comments

Comments
 (0)