diff --git a/.gitea/workflows/repo-health.yml b/.gitea/workflows/repo-health.yml index 079d2b6..5c6a513 100644 --- a/.gitea/workflows/repo-health.yml +++ b/.gitea/workflows/repo-health.yml @@ -608,8 +608,24 @@ jobs: fi if [ -f "${DOCS_INDEX}" ]; then - missing_links="$(python3 - <<'PY' - import os + missing_links="" + if [ -f "${DOCS_INDEX}" ]; then + while IFS= read -r line; do + for link in $(echo "$line" | grep -oP '\]\(\K[^)]+' || true); do + case "$link" in http://*|https://*|\#*|mailto:*) continue ;; esac + linkpath="${link%%#*}" + linkpath="${linkpath%%\?*}" + [ -z "$linkpath" ] && continue + if [ "${linkpath:0:1}" = "/" ]; then + testpath="${linkpath#/}" + else + testpath="$(dirname "${DOCS_INDEX}")/${linkpath}" + fi + [ ! -e "$testpath" ] && missing_links="${missing_links}${testpath} +" + done + done < "${DOCS_INDEX}" + fi import re idx = os.environ.get('DOCS_INDEX', 'docs/docs-index.md')