diff --git a/.lychee.toml b/.lychee.toml new file mode 100644 index 0000000000..812f0efbb0 --- /dev/null +++ b/.lychee.toml @@ -0,0 +1,15 @@ +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|issue)/\\d+$" +] + +# better to be safe and avoid failures +max-retries = 6 + +# insecure is currently needed for https://osi-model.com +insecure = true diff --git a/.markdown_link_check_config.json b/.markdown_link_check_config.json deleted file mode 100644 index 980cc95414..0000000000 --- a/.markdown_link_check_config.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "ignorePatterns": [ - { - "pattern": "^https://github\\.com/open-telemetry/opentelemetry-specification/(issues|pull)" - }, - { - "pattern": "^https://github\\.com/open-telemetry/semantic-conventions/(issues|pull|actions)" - }, - { - "pattern": "^https://blogs.oracle.com/linux/post/understanding-linux-kernel-memory-statistics$" - }, - { - "pattern": "^#" - } - ], - "replacementPatterns": [ - { - "pattern": "^/", - "replacement": "{{BASEURL}}/" - }, - { - "pattern": "^https://github.com/open-telemetry/semantic-conventions/(blob|tree)/main/docs/", - "replacement": "LINK-CHECK-ERROR-USE-LOCAL-PATH-TO-DOC-PAGE-NOT-EXTERNAL-URL/" - } - ], - "httpHeaders": [ - { - "urls": ["http", ".", "/"], - "headers": { - "User-Agent": "Mozilla/5.0 (compatible; OpenTelemetryDocsBot/1.0)" - } - } - ], - "retryOn429": true, - "timeout": "30s", - "aliveStatusCodes": [200, 403] -} diff --git a/Makefile b/Makefile index 6f2cf5c809..cec02e4e9f 100644 --- a/Makefile +++ b/Makefile @@ -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: