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
31 changes: 31 additions & 0 deletions .github/workflows/link-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
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@v7
- name: Set up Ruby
uses: ruby/setup-ruby@9eb537ca036ebaed86729dcb9309076e4c5c3b74
- name: Get NodeJS version
run: echo "NODE_VERSION=$(cat .node-version)" >> $GITHUB_OUTPUT
id: node_version
- name: Set up NodeJS
uses: actions/setup-node@v6.4.0
with:
node-version: "${{ steps.node_version.outputs.NODE_VERSION }}"
- name: Bootstrap
run: script/bootstrap
- name: Build site
run: script/build
- name: Check links (including external URLs)
run: bundle exec script/html-proofer
env:
CHECK_EXTERNAL_LINKS: true
14 changes: 14 additions & 0 deletions script/html-proofer
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
#!/usr/bin/env ruby
require "html-proofer"

# External (remote) link checking is opt-in.
# Set CHECK_EXTERNAL_LINKS=true to enable (used by weekly scheduled 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

url_ignores = [
"http://comcast.com",
]

HTMLProofer.check_directories(
["_site"],
disable_external: !check_external,
enforce_https: false,
ignore_status_codes: [429],
ignore_urls: url_ignores,
Expand Down
6 changes: 5 additions & 1 deletion script/test
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@
set -e

script/build
bundle exec script/html-proofer

# Skip external URL checks in normal CI. 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 bundle exec script/html-proofer