From 79e2c0c14edf28e96289ddfd46cc06e62d527684 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 23 Mar 2026 12:16:08 +0000 Subject: [PATCH] Replace lychee with targeted ISO link validation for src/define.sh Co-authored-by: kroese <5763256+kroese@users.noreply.github.com> Agent-Logs-Url: https://github.com/dockur/windows/sessions/828997f3-2043-4f5a-94df-76321b177c73 --- .github/workflows/check.yml | 45 ++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 5bb63cf..dc963b6 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -35,6 +35,45 @@ jobs: yaml_exclude_regex: ".*\\kubernetes\\.yml$" - name: Validate Links - uses: lycheeverse/lychee-action@v2 - with: - fail: true + run: | + errors=0 + count=0 + host="" + declare -A seen + + check() { + local url="$1" http + http=$(curl -sSL -o /dev/null -w "%{http_code}" --max-time 10 -I -- "$url" 2>&1) || http="000" + [[ "$http" == 2* ]] && return 0 + http=$(curl -sSL -o /dev/null -w "%{http_code}" --max-time 10 -r "0-0" -- "$url" 2>&1) || http="000" + [[ "$http" == 2* ]] + } + + while IFS= read -r line; do + if [[ "$line" =~ ^[[:space:]]*local[[:space:]]+host=\"(https://[^\"]+)\" ]]; then + host="${BASH_REMATCH[1]%/}" + continue + fi + [[ "$line" =~ ^[[:space:]]*url=\"(.+)\" ]] || continue + val="${BASH_REMATCH[1]#/}" + if [[ "$val" == https://* ]]; then + url="$val" + elif [[ -n "$host" ]]; then + url="$host/$val" + else + continue + fi + [[ -v seen[$url] ]] && continue + seen[$url]=1 + count=$((count + 1)) + if check "$url"; then + echo " OK: $url" + else + echo "FAIL: $url" + errors=$((errors + 1)) + fi + done < "src/define.sh" + + echo "" + printf '%d/%d links valid\n' "$(( count - errors ))" "$count" + (( errors == 0 ))