Skip to content
Draft
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
39 changes: 39 additions & 0 deletions .github/workflows/link-check-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Cache link check results on each commit to main.

name: Lychee Cache Update

on:
push:
branches: [main]

jobs:
lychee-cache-update:
name: Lychee Link Checking
runs-on: ubuntu-latest

steps:
- name: Check out repo
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0

- name: Restore Lychee cache
id: restore-cache
uses: actions/cache/restore@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
with:
path: .lycheecache
key: cache-lychee-${{ github.event.before }}
restore-keys: cache-lychee-

- name: Run Lychee
uses: lycheeverse/lychee-action@a8c4c7cb88f0c7386610c35eb25108e448569cb0 # v2.7.0
with:
fail: false
format: markdown
jobSummary: true
args: >
-c lychee.toml --root-dir "$(pwd)" './**/*.mdx'

- name: Update Lychee cache
uses: actions/cache/save@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
with:
path: .lycheecache
key: cache-lychee-${{ github.event.after }}
13 changes: 12 additions & 1 deletion .github/workflows/link-check.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Check links on changed MDX files in PRs.

name: Lychee Link Checking

on:
# Run on PRs targeting main that change content files.
pull_request:
branches: [main]
paths: ['**/*.mdx?']
Expand All @@ -24,8 +25,17 @@ jobs:
files: |
**.mdx

- name: Restore Lychee cache
uses: actions/cache/restore@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
if: steps.changed-mdx-files.outputs.any_changed == 'true'
with:
path: .lycheecache
key: cache-lychee-${{ github.event.pull_request.base.sha }}
restore-keys: cache-lychee-

- name: Run Lychee
uses: lycheeverse/lychee-action@a8c4c7cb88f0c7386610c35eb25108e448569cb0 # v2.7.0
if: steps.changed-mdx-files.outputs.any_changed == 'true'
with:
fail: false
format: markdown
Expand All @@ -37,5 +47,6 @@ jobs:

- name: Comment on PR with link check results
uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2.9.4
if: steps.changed-mdx-files.outputs.any_changed == 'true'
with:
path: lychee/out.md
2 changes: 1 addition & 1 deletion lychee.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ include_verbatim = false # Don't check links inside code blocks
exclude_all_private = true # Exclude link local, loopback, and private IPs.

# Cache only successful results to avoid re-checking valid links.
# TODO: Update GitHub Action to use the cache
cache = true
cache_exclude_status = "300.."
max_cache_age = "7d"

# Set a root dir so Lychee can resolve relative links to URIs, even though we
# exclude relative links in the actual check.
Expand Down