Skip to content

Commit 55d39ef

Browse files
authored
Merge branch 'main' into dependabot/github_actions/actions/checkout-7
2 parents b746eca + dd86bf7 commit 55d39ef

5 files changed

Lines changed: 58 additions & 3 deletions

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="$?"

test/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"dictionary-en-us": "^2.0.0",
66
"glob": "^7.0.5",
77
"ignore": "^3.1.3",
8-
"js-yaml": "^3.6.1",
8+
"js-yaml": "^4.2.0",
99
"remark-frontmatter": "^1.1.0",
1010
"remark-lint": "^6.0.0",
1111
"remark-lint-blockquote-indentation": "^1.0.0",

test/prose

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ var fs = require('fs');
5656
var path = require('path');
5757
var async = require('async');
5858
var yaml = require('js-yaml');
59-
var jekyllConfig = yaml.safeLoad(fs.readFileSync('_config.yml'));
59+
var jekyllConfig = yaml.load(fs.readFileSync('_config.yml'));
6060
var ignore = require('ignore')().add(jekyllConfig.exclude)
6161

6262
var personal = fs

0 commit comments

Comments
 (0)