Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/link-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Weekly External Link Check
on:
schedule:
# Every Monday at 08:00 UTC
- cron: "0 8 * * 1"
workflow_dispatch:
permissions:
contents: read
jobs:
link-check:
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v6
- name: Set up Ruby
uses: ruby/setup-ruby@89f90524b88a01fe6e0b732220432cc6142926af # v1
with:
bundler-cache: true
- name: Set up Node
uses: actions/setup-node@v6.4.0
- name: Bootstrap
run: script/bootstrap
env:
SKIP_BUNDLER: true
- name: Build site
run: script/build --config _config.yml,test/_config.yml
- name: Check links (including external URLs)
run: script/html-proofer
env:
CHECK_EXTERNAL_LINKS: true
21 changes: 21 additions & 0 deletions script/html-proofer
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,26 @@
require "bundler/setup"
require "html-proofer"

# ---------------------------------------------------------
# External (remote) link checking is opt-in.
#
# Remote URL checks are slow and frequently fail in CI due to
# rate limiting and transient network errors on third-party
# sites. By default we skip them so normal CI runs stay fast
# and reliable. Set CHECK_EXTERNAL_LINKS=true to enable the
# full remote link check (used by the scheduled weekly run).
# ---------------------------------------------------------
check_external = %w[1 true yes].include?(
ENV.fetch("CHECK_EXTERNAL_LINKS", "").strip.downcase
)

if check_external
puts "==> Running HTMLProofer WITH external link checks"
else
puts "==> Running HTMLProofer WITHOUT external link checks " \
"(set CHECK_EXTERNAL_LINKS=true to enable)"
end

# ---------------------------------------------------------
# URLs & patterns to ignore during link checking.
# Some websites block automated requests, cause false
Expand Down Expand Up @@ -63,6 +83,7 @@ HTMLProofer::Runner.new(
["_site"], # Directory containing the generated site
parallel: { in_threads: 4 }, # Speed up checks using 4 threads
type: :directory,
disable_external: !check_external, # Skip remote URL checks unless opted in
ignore_urls: url_ignores, # Skip known-problematic URLs
check_html: true, # Validate HTML structure
check_opengraph: true, # Check for OpenGraph tags
Expand Down
6 changes: 5 additions & 1 deletion script/test
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ bundle exec rake

set +e

script/html-proofer
# Skip remote/external URL checks in normal CI runs. They are slow and
# frequently fail due to rate limiting on third-party sites. The full
# external link check runs on a weekly schedule (see
# .github/workflows/link-check.yml).
CHECK_EXTERNAL_LINKS=false script/html-proofer
HTML_PROOFER_EXIT="$?"
test/prose
PROSE_EXIT="$?"
Expand Down
2 changes: 1 addition & 1 deletion test/prose
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ var fs = require('fs');
var path = require('path');
var async = require('async');
var yaml = require('js-yaml');
var jekyllConfig = yaml.safeLoad(fs.readFileSync('_config.yml'));
var jekyllConfig = yaml.load(fs.readFileSync('_config.yml'));
Comment thread
ahpook marked this conversation as resolved.
var ignore = require('ignore')().add(jekyllConfig.exclude)

var personal = fs
Expand Down
Loading