Skip to content

Commit 2aa6a3a

Browse files
tomthorogoodCopilot
andcommitted
Move external link checks to a weekly scheduled run
External URL checks are slow and frequently fail in CI due to rate limiting and transient network errors on third-party sites, which can block otherwise valid contributions. - Make external link checking opt-in via CHECK_EXTERNAL_LINKS env var - Disable external checks in script/test (used by CI) - Add weekly scheduled workflow for full external link validation Mirrors the approach taken in github/opensource.guide#3703. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 9f5401a commit 2aa6a3a

3 files changed

Lines changed: 50 additions & 1 deletion

File tree

.github/workflows/link-check.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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@v7
15+
- name: Set up Ruby
16+
uses: ruby/setup-ruby@9eb537ca036ebaed86729dcb9309076e4c5c3b74
17+
- name: Get NodeJS version
18+
run: echo "NODE_VERSION=$(cat .node-version)" >> $GITHUB_OUTPUT
19+
id: node_version
20+
- name: Set up NodeJS
21+
uses: actions/setup-node@v6.4.0
22+
with:
23+
node-version: "${{ steps.node_version.outputs.NODE_VERSION }}"
24+
- name: Bootstrap
25+
run: script/bootstrap
26+
- name: Build site
27+
run: script/build
28+
- name: Check links (including external URLs)
29+
run: bundle exec script/html-proofer
30+
env:
31+
CHECK_EXTERNAL_LINKS: true

script/html-proofer

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
11
#!/usr/bin/env ruby
22
require "html-proofer"
33

4+
# External (remote) link checking is opt-in.
5+
# Set CHECK_EXTERNAL_LINKS=true to enable (used by weekly scheduled run).
6+
check_external = %w[1 true yes].include?(
7+
ENV.fetch("CHECK_EXTERNAL_LINKS", "").strip.downcase
8+
)
9+
10+
if check_external
11+
puts "==> Running HTMLProofer WITH external link checks"
12+
else
13+
puts "==> Running HTMLProofer WITHOUT external link checks " \
14+
"(set CHECK_EXTERNAL_LINKS=true to enable)"
15+
end
16+
417
url_ignores = [
518
"http://comcast.com",
619
]
720

821
HTMLProofer.check_directories(
922
["_site"],
23+
disable_external: !check_external,
1024
enforce_https: false,
1125
ignore_status_codes: [429],
1226
ignore_urls: url_ignores,

script/test

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@
33
set -e
44

55
script/build
6-
bundle exec script/html-proofer
6+
7+
# Skip external URL checks in normal CI. They are slow and frequently fail
8+
# due to rate limiting on third-party sites. The full external link check
9+
# runs on a weekly schedule (see .github/workflows/link-check.yml).
10+
CHECK_EXTERNAL_LINKS=false bundle exec script/html-proofer

0 commit comments

Comments
 (0)