From 9c47c52de533ba05d122f5a9b036992dcd84aba6 Mon Sep 17 00:00:00 2001 From: Peter Tripp Date: Tue, 10 Jun 2025 11:20:07 -0400 Subject: [PATCH] ci: Restore lychee link check. Only validate internal links (#32463) Follow-up to: https://github.com/zed-industries/zed/pull/32460 Follow-up to: https://github.com/zed-industries/zed/pull/30844 Release Notes: - N/A --- .github/actions/build_docs/action.yml | 6 ++++++ script/check-links | 27 ++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/.github/actions/build_docs/action.yml b/.github/actions/build_docs/action.yml index 27f0f37d4f..9a2d7e1ec7 100644 --- a/.github/actions/build_docs/action.yml +++ b/.github/actions/build_docs/action.yml @@ -19,6 +19,12 @@ runs: shell: bash -euxo pipefail {0} run: ./script/linux + - name: Check for broken links + uses: lycheeverse/lychee-action@82202e5e9c2f4ef1a55a3d02563e1cb6041e5332 # v2.4.1 + with: + args: --no-progress --exclude '^http' './docs/src/**/*' + fail: true + - name: Build book shell: bash -euxo pipefail {0} run: | diff --git a/script/check-links b/script/check-links index 0f9840ec06..259ce1d1b9 100755 --- a/script/check-links +++ b/script/check-links @@ -2,6 +2,31 @@ set -euo pipefail +usage() { + echo "Usage: $0 [local|all] [--help]" + echo " local Only check local links (default)" + echo " all Check all links including remote ones" + exit 1 +} + +check_mode="local" +if [ $# -eq 1 ]; then + case "$1" in + "local") check_mode="local" ;; + "all") check_mode="all" ;; + "--help") usage ;; + *) echo "Invalid argument: $1" && usage ;; + esac +else + usage +fi + cargo install lychee cd "$(dirname "$0")/.." -lychee --no-progress './docs/src/**/*' + +if [ "$check_mode" = "all" ]; then + lychee --no-progress './docs/src/**/*' +else + lychee --exclude '^http' './docs/src/**/*' +fi +#