From 5ca9f7fa385e3591e6abdc954bf6b1e32a19975f Mon Sep 17 00:00:00 2001 From: James Shubin Date: Mon, 1 Jul 2024 13:40:14 -0400 Subject: [PATCH] test: Skip link check by default We should run this periodically or put it in a separate job, as it's causing the tests to fail all the time. I expect those sites may be blocking github as they see it as a DOS. --- test/test-markdownlint.sh | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/test/test-markdownlint.sh b/test/test-markdownlint.sh index daf54ada..dc36c413 100755 --- a/test/test-markdownlint.sh +++ b/test/test-markdownlint.sh @@ -42,11 +42,16 @@ EOF #STYLE="test/mdl.style" # style file -LYCHEE=$(command -v lychee 2>/dev/null) || true -if [ -z "$LYCHEE" ]; then - fail_test "The 'lychee' utility can't be found. - Installation guide: - https://github.com/lycheeverse/lychee/blob/master/README.md#installation" +CHECK_LINKS=false +if [ "$1" = "--check-links" ]; then + shift # pop the $1 arg + CHECK_LINKS=true + LYCHEE=$(command -v lychee 2>/dev/null) || true + if [ -z "$LYCHEE" ]; then + fail_test "The 'lychee' utility can't be found. + Installation guide: + https://github.com/lycheeverse/lychee/blob/master/README.md#installation" + fi fi find_files() { @@ -73,9 +78,11 @@ bad_files=$( fi # check links in docs - # if file is from the directory docs/ then check links - if [[ "$i" == docs/* ]] && ! "$LYCHEE" -n "$i" 1>&2; then - echo "$i" + if $CHECK_LINKS; then + # if file is from the directory docs/ then check links + if [[ "$i" == docs/* ]] && ! "$LYCHEE" -n "$i" 1>&2; then + echo "$i" + fi fi done )