Skip to content
Draft
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
25 changes: 25 additions & 0 deletions .github/workflows/linkcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,31 @@ jobs:
run: |
mkdir -p _site
curl -sL "${{ steps.release.outputs.asset-url }}" | tar -xz -C _site
- name: Pre-process HTML to exclude known bot-blocking domains
env:
# Domains that block automated crawlers (space-separated).
# These are also listed in linkcheck_ignore in lectures/_config.yml.
SKIP_DOMAINS: "fred.stlouisfed.org"
run: |
python3 - <<'PYEOF'
import os
import re
from pathlib import Path
skip_domains = os.environ.get('SKIP_DOMAINS', '').split()
count = 0
for html_file in Path('_site').rglob('*.html'):
try:
content = html_file.read_text(encoding='utf-8')
except UnicodeDecodeError as exc:
print(f"Skipping {html_file}: encoding error - {exc}")
continue
for domain in skip_domains:
pattern = r'href="https?://' + re.escape(domain) + r'[^"]*"'
content = re.sub(pattern, 'href="#"', content)
html_file.write_text(content, encoding='utf-8')
count += 1
print(f"Pre-processing complete ({count} files processed)")
PYEOF
- name: AI-Powered Link Checker
uses: QuantEcon/action-link-checker@main
with:
Expand Down