Skip to content

Commit

Permalink
CI: Fix docs broken link checker
Browse files Browse the repository at this point in the history
  • Loading branch information
kernc committed Nov 26, 2024
1 parent 224c228 commit 0734db1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions doc/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ fi
echo
echo 'Testing for broken links'
echo
problematic_urls='
https://www.gnu.org/licenses/agpl-3.0.html
'
pushd "$BUILDROOT" >/dev/null
grep -PR '<a .*?href=' |
sed -E "s/:.*?<a .*?href=([\"'])(.*?)/\t\2/g" |
Expand All @@ -58,9 +61,12 @@ for line in sys.stdin.readlines():
grep -v $'\t''$' |
while read -r line; do
while IFS=$'\t' read -r file url; do
echo "$file: $url"
[ -f "$url" ] ||
curl --silent --fail --retry 5 --retry-delay 5 --user-agent 'Mozilla/5.0 Firefox 61' "$url" >/dev/null 2>&1 ||
die "broken link in $file: $url"
curl --silent --fail --retry 3 --retry-delay 1 --connect-timeout 10 \
--user-agent 'Mozilla/5.0 Firefox 125' "$url" >/dev/null 2>&1 ||
grep -qF "$url" <(echo "$problematic_urls") ||
die "broken link in $file: $url"
done
done
popd >/dev/null
Expand Down

0 comments on commit 0734db1

Please sign in to comment.