Skip to content

Commit 3d7a527

Browse files
committed
feat(actions): add gh action for markdown linting of the spec file
1 parent e1b518b commit 3d7a527

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

.github/workflows/validate-markdown.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ jobs:
2525
with:
2626
node-version: '20.x'
2727
- name: Validate markdown
28-
run: npx --yes mdv ./{versions,schemas/**}/*.md
28+
run: npx --yes mdv ./versions/[1-2].*.md
2929
- name: Lint markdown
30-
run: npx --yes markdownlint-cli --config .markdownlint.yaml ./{versions,schemas/**}/*.md
30+
run: npx --yes markdownlint-cli --config .markdownlint.yaml versions/1.0.[^0].md versions/1.[1-9].*.md versions/2.*.md

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"scripts": {
66
"build": "bash ./scripts/md2html/build.sh",
77
"test": "echo \"Error: no test specified\" && exit 1",
8-
"format-markdown": "bash ./scripts/format-markdown.sh ./{versions,schemas/**}/*.md"
8+
"format-markdown": "bash ./scripts/format-markdown.sh versions/1.0.[^0].md versions/1.[1-9].*.md versions/2.*.md"
99
},
1010
"repository": {
1111
"type": "git",

scripts/format-markdown.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
SRCDIR="$(dirname "${BASH_SOURCE[0]}")" # check on Windows
44

55
for filename in $*; do
6+
# check if the $filename exists and if it's writeable
7+
if [ ! -w $filename ]; then
8+
echo "No matching file found: $filename"
9+
continue;
10+
fi
611
# mostly to format code blocks with examples, unfortunately messes up bullet lists and tables
712
npx prettier --write --single-quote $filename
813

0 commit comments

Comments
 (0)