From 85deea82e4acc5e09f85a41be3f60355f0f9be2d Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Thu, 28 Aug 2025 16:56:40 +0100 Subject: [PATCH] build: add local markdown linting to make check --- Makefile | 1 + bin/markdown-lint | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100755 bin/markdown-lint diff --git a/Makefile b/Makefile index 8ed067f66..3c5981890 100644 --- a/Makefile +++ b/Makefile @@ -100,6 +100,7 @@ compiletest: check: rclone @echo "-- START CODE QUALITY REPORT -------------------------------" @golangci-lint run $(LINTTAGS) ./... + @bin/markdown-lint @echo "-- END CODE QUALITY REPORT ---------------------------------" # Get the build dependencies diff --git a/bin/markdown-lint b/bin/markdown-lint new file mode 100755 index 000000000..960ee4798 --- /dev/null +++ b/bin/markdown-lint @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +# +# Run markdown linting locally +set -e + +# Workflow +build=.github/workflows/build.yml + +# Globs read from from $build +globs=$(awk '/- name: Check Markdown format/{f=1;next} f && /globs:/{f=2;next} f==2 && NF{if($1=="-"){exit} print $0}' $build) + +if [ -z "$globs" ]; then + echo "Error: No globs found in Check Markdown step in $build" >&2 + exit 1 +fi + +docker run -v $PWD:/workdir --user $(id -u):$(id -g) davidanson/markdownlint-cli2 $globs