CI: add markdown lint (MR 2485)

Add a CI job to enforce markdown linting

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
Caleb Connolly 2024-11-12 01:50:11 +01:00 committed by Oliver Smith
parent 67773c4293
commit 14d9134d8b
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
2 changed files with 28 additions and 0 deletions

23
.ci/markdown.sh Executable file
View file

@ -0,0 +1,23 @@
#!/bin/sh -e
# Description: lint all markdown files
# https://postmarketos.org/pmb-ci
if [ "$(id -u)" = 0 ]; then
set -x
apk add npm
npm install -g markdownlint-cli
ln -sf /usr/local/lib/node_modules/markdownlint-cli/markdownlint.js /usr/bin/markdownlint-cli
exec su "${TESTUSER:-build}" -c "sh -e $0"
fi
MDL_FAILED=0
find . -name '*.md' |
while read -r file; do
echo "mdl: $file"
markdownlint-cli "$file" || MDL_FAILED=1
done
if [ "$MDL_FAILED" = "1" ]; then
echo "markdown lint failed!"
exit 1
fi

View file

@ -30,6 +30,11 @@ codespell:
script: script:
- ".ci/codespell.sh" - ".ci/codespell.sh"
markdownlint:
stage: test
script:
- ".ci/markdown.sh"
pytest: pytest:
stage: test stage: test
script: script: