mirror of https://github.com/linkerd/linkerd2.git
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>
This commit is contained in:
parent
30ba9a1261
commit
d99c1486ba
|
@ -88,3 +88,12 @@ jobs:
|
|||
! -name *.nuspec \
|
||||
! -name *.ps1 \
|
||||
| xargs -I {} bin/shellcheck -x -P ./bin {}
|
||||
markdown_lint:
|
||||
name: Markdown lint
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- name: Checkout code
|
||||
# actions/checkout@v2
|
||||
uses: actions/checkout@722adc6
|
||||
- name: Markdown lint
|
||||
run: bin/markdownlint-all
|
|
@ -13,3 +13,4 @@ web/app/yarn-error.log
|
|||
**/*.gogen*
|
||||
**/*.swp
|
||||
charts/**/charts
|
||||
package-lock.json
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
default: true
|
||||
line_length:
|
||||
code_blocks: false
|
||||
tables: false
|
||||
headings:
|
||||
siblings_only: true
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
bindir=$( cd "${BASH_SOURCE[0]%/*}" && pwd )
|
||||
rootdir=$( cd "$bindir"/.. && pwd )
|
||||
markdownlintbin="$rootdir/node_modules/.bin/markdownlint"
|
||||
|
||||
markdownlint_version=0.23.1
|
||||
|
||||
if [ ! -x "$markdownlintbin" ] || [ "$($markdownlintbin -V)" != $markdownlint_version ]; then
|
||||
if ! [ -x "$(command -v npm)" ]; then
|
||||
echo "Error: npm required to install markdownlint command"
|
||||
exit 1
|
||||
fi
|
||||
npm install markdownlint-cli@$markdownlint_version
|
||||
fi
|
||||
|
||||
"$markdownlintbin" "$@"
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
bindir=$( cd "${BASH_SOURCE[0]%/*}" && pwd )
|
||||
|
||||
"$bindir"/markdownlint ./*.md
|
||||
"$bindir"/markdownlint ./**/*.md --ignore node_modules/
|
Loading…
Reference in New Issue