Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cross-file anchor link check (use lychee for markdown link checking) #1697

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 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
7 changes: 7 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ jobs:
- name: install dependencies
run: npm install

- name: Restore lychee cache
uses: actions/cache@v4
with:
path: .lycheecache
key: cache-lychee-${{ github.sha }}
restore-keys: cache-lychee-

trask marked this conversation as resolved.
Show resolved Hide resolved
- name: run markdown-link-check
run: make markdown-link-check

Expand Down
16 changes: 16 additions & 0 deletions .lychee.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
include-fragments = true

accept = ["200..=299", "403"]

exclude = [
"^https://www.foo.bar",
# excluding links to pull requests and issues is done for performance
"^https://github.com/open-telemetry/semantic-conventions/pull/\\d+$",
"^https://github.com/open-telemetry/semantic-conventions/issue/\\d+$"
]

# better to be safe and avoid failures
max-retries = 6

# insecure is currently needed for https://osi-model.com
insecure = true
37 changes: 0 additions & 37 deletions .markdown_link_check_config.json

This file was deleted.

12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,13 @@ misspell-correction: $(MISSPELL)

.PHONY: markdown-link-check
markdown-link-check:
@if ! npm ls markdown-link-check; then npm install; fi
@for f in $(ALL_DOCS); do \
npx --no -- markdown-link-check --quiet --config .markdown_link_check_config.json $$f \
|| exit 1; \
done
docker run --rm \
--mount 'type=bind,source=$(PWD),target=/home/repo' \
lycheeverse/lychee \
--config home/repo/.lychee.toml \
--root-dir /home/repo \
-v \
home/repo

.PHONY: markdown-link-check-changelog-preview
markdown-link-check-changelog-preview:
Expand Down
Loading