From 95a88bac681572351a7eaac4c52e5865895d9bb5 Mon Sep 17 00:00:00 2001 From: Markus Frosch Date: Wed, 21 Apr 2021 16:32:14 +0200 Subject: [PATCH 1/2] ci: Add markdown-link-check --- .github/workflows/markdown-links.yml | 10 ++++++++++ tools/markdown-link-check.sh | 18 ++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 .github/workflows/markdown-links.yml create mode 100755 tools/markdown-link-check.sh diff --git a/.github/workflows/markdown-links.yml b/.github/workflows/markdown-links.yml new file mode 100644 index 000000000..b8f5d2f7f --- /dev/null +++ b/.github/workflows/markdown-links.yml @@ -0,0 +1,10 @@ +name: Check Markdown links + +on: push + +jobs: + markdown-link-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: gaurav-nelson/github-action-markdown-link-check@v1 diff --git a/tools/markdown-link-check.sh b/tools/markdown-link-check.sh new file mode 100755 index 000000000..a313fca54 --- /dev/null +++ b/tools/markdown-link-check.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +set -e + +PATH="$(pwd)/node_modules/.bin:${PATH}" + +errors=0 + +while read -r file; do + if ! markdown-link-check --quiet "$file"; then + (( errors++ )) || true + fi +done < <(find -name \*.md) + +if [[ $errors -gt 0 ]]; then + echo "Found ${errors} files with errors!" + exit 1 +fi From c380efa62841e23285737eecf822303ca0c39a08 Mon Sep 17 00:00:00 2001 From: Markus Frosch Date: Wed, 21 Apr 2021 17:13:06 +0200 Subject: [PATCH 2/2] Tune settings for markdown-link-check - Don't check GitHub issue URLs - Quiet mode for more overview --- .github/workflows/markdown-links.yml | 3 +++ tools/markdown-link-check.json | 5 +++++ tools/markdown-link-check.sh | 4 +++- 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 tools/markdown-link-check.json diff --git a/.github/workflows/markdown-links.yml b/.github/workflows/markdown-links.yml index b8f5d2f7f..d9dfcaca7 100644 --- a/.github/workflows/markdown-links.yml +++ b/.github/workflows/markdown-links.yml @@ -8,3 +8,6 @@ jobs: steps: - uses: actions/checkout@v2 - uses: gaurav-nelson/github-action-markdown-link-check@v1 + with: + config-file: tools/markdown-link-check.json + use-quiet-mode: yes diff --git a/tools/markdown-link-check.json b/tools/markdown-link-check.json new file mode 100644 index 000000000..2daa98ab1 --- /dev/null +++ b/tools/markdown-link-check.json @@ -0,0 +1,5 @@ +{ + "ignorePatterns": [ + {"pattern": "^https://github.com/icinga/icinga2/issues/"} + ] +} diff --git a/tools/markdown-link-check.sh b/tools/markdown-link-check.sh index a313fca54..c77740b3d 100755 --- a/tools/markdown-link-check.sh +++ b/tools/markdown-link-check.sh @@ -7,12 +7,14 @@ PATH="$(pwd)/node_modules/.bin:${PATH}" errors=0 while read -r file; do - if ! markdown-link-check --quiet "$file"; then + if ! markdown-link-check --config tools/markdown-link-check.json --quiet "$file"; then (( errors++ )) || true fi done < <(find -name \*.md) if [[ $errors -gt 0 ]]; then + echo echo "Found ${errors} files with errors!" + echo exit 1 fi