Skip to content

Commit 14bedcf

Browse files
ahpookCopilot
andcommitted
Skip external URL checks in CI; add weekly link check
HTMLProofer remote URL checks frequently fail in CI due to rate limiting on third-party sites. Make external checks opt-in via the CHECK_EXTERNAL_LINKS env var (default off) so normal CI runs stay fast and reliable, and add a weekly scheduled workflow that runs the full external link check. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent d77711f commit 14bedcf

3 files changed

Lines changed: 56 additions & 1 deletion

File tree

.github/workflows/link-check.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Weekly External Link Check
2+
on:
3+
schedule:
4+
# Every Monday at 08:00 UTC
5+
- cron: "0 8 * * 1"
6+
workflow_dispatch:
7+
permissions:
8+
contents: read
9+
jobs:
10+
link-check:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Set up Git repository
14+
uses: actions/checkout@v6
15+
- name: Set up Ruby
16+
uses: ruby/setup-ruby@89f90524b88a01fe6e0b732220432cc6142926af # v1
17+
with:
18+
bundler-cache: true
19+
- name: Set up Node
20+
uses: actions/setup-node@v6.4.0
21+
- name: Bootstrap
22+
run: script/bootstrap
23+
env:
24+
SKIP_BUNDLER: true
25+
- name: Build site
26+
run: script/build --config _config.yml,test/_config.yml
27+
- name: Check links (including external URLs)
28+
run: script/html-proofer
29+
env:
30+
CHECK_EXTERNAL_LINKS: true

script/html-proofer

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,26 @@
2222
require "bundler/setup"
2323
require "html-proofer"
2424

25+
# ---------------------------------------------------------
26+
# External (remote) link checking is opt-in.
27+
#
28+
# Remote URL checks are slow and frequently fail in CI due to
29+
# rate limiting and transient network errors on third-party
30+
# sites. By default we skip them so normal CI runs stay fast
31+
# and reliable. Set CHECK_EXTERNAL_LINKS=true to enable the
32+
# full remote link check (used by the scheduled weekly run).
33+
# ---------------------------------------------------------
34+
check_external = %w[1 true yes].include?(
35+
ENV.fetch("CHECK_EXTERNAL_LINKS", "").strip.downcase
36+
)
37+
38+
if check_external
39+
puts "==> Running HTMLProofer WITH external link checks"
40+
else
41+
puts "==> Running HTMLProofer WITHOUT external link checks " \
42+
"(set CHECK_EXTERNAL_LINKS=true to enable)"
43+
end
44+
2545
# ---------------------------------------------------------
2646
# URLs & patterns to ignore during link checking.
2747
# Some websites block automated requests, cause false
@@ -63,6 +83,7 @@ HTMLProofer::Runner.new(
6383
["_site"], # Directory containing the generated site
6484
parallel: { in_threads: 4 }, # Speed up checks using 4 threads
6585
type: :directory,
86+
disable_external: !check_external, # Skip remote URL checks unless opted in
6687
ignore_urls: url_ignores, # Skip known-problematic URLs
6788
check_html: true, # Validate HTML structure
6889
check_opengraph: true, # Check for OpenGraph tags

script/test

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ bundle exec rake
77

88
set +e
99

10-
script/html-proofer
10+
# Skip remote/external URL checks in normal CI runs. They are slow and
11+
# frequently fail due to rate limiting on third-party sites. The full
12+
# external link check runs on a weekly schedule (see
13+
# .github/workflows/link-check.yml).
14+
CHECK_EXTERNAL_LINKS=false script/html-proofer
1115
HTML_PROOFER_EXIT="$?"
1216
test/prose
1317
PROSE_EXIT="$?"

0 commit comments

Comments
 (0)