Skip to content

Link Checker (lychee) #1264

Link Checker (lychee)

Link Checker (lychee) #1264

Workflow file for this run

name: Link Checker (lychee)
on:
schedule:
# UTC 23:00 is early morning in Australia (9am)
- cron: '0 23 * * 1'
workflow_dispatch:
jobs:
link-checking:
name: Link Checking
runs-on: "ubuntu-latest"
permissions:
issues: write # required for peter-evans/create-issue-from-file
steps:
# Checkout the live site (html)
- name: Checkout
uses: actions/checkout@v7
with:
ref: gh-pages
- name: Link Checker
id: lychee
uses: lycheeverse/lychee-action@v2
with:
fail: false
# --root-dir resolves root-relative links (e.g. /_notebooks/*.ipynb,
# /_pdf/quantecon-python.pdf) against the gh-pages checkout so they are
# not reported as errors. See QuantEcon/lecture-python.myst#906.
#
# The flags below clear the residual false positives reported in
# QuantEcon/lecture-python.myst#933. Configuration is kept inline (rather
# than a lychee.toml) because lychee runs against the gh-pages checkout,
# which does not contain repo-root config files.
# --accept 202 IEEE Xplore returns "202 Accepted" (anti-bot) for
# valid links, e.g. doi.org/10.1109/TAC.1977.1101561
# --exclude-path ... genindex / search / prf-prf are auto-generated
# utility pages with no source notebook, so the
# theme's "Download Notebook" button points at a
# nonexistent _notebooks/<page>.ipynb (and renders a
# second button with href="None"). They carry no
# unique content links, so skipping them loses no
# coverage.
# --exclude <doi> Journal of Derivatives DOI redirects into a
# login/paywall loop (exceeds max-redirects); the
# citation itself is valid.
args: >-
--root-dir ${{ github.workspace }}
--accept 200,202,403,503
--exclude-path 'genindex\.html$'
--exclude-path 'search\.html$'
--exclude-path 'prf-prf\.html$'
--exclude '10\.3905/jod\.2012\.20\.1\.038'
*.html
- name: Create Issue From File
if: steps.lychee.outputs.exit_code != 0
uses: peter-evans/create-issue-from-file@v6
with:
title: Link Checker Report
content-filepath: ./lychee/out.md
labels: report, automated issue, linkchecker