ci: catch broken markdown links#403
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds an offline broken-Markdown-link check to the existing pre-commit-driven lint workflow (both locally and in CI) by introducing the lychee pre-commit hook, and updates the lint step wording to reflect the broader checks.
Changes:
- Add
lycheeas a pre-commit hook (offline) to detect broken links in Markdown files. - Update the CI lint step name/message to mention Markdown link checks.
- Add an acknowledgment entry for the contributor who introduced the link checks.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
ACKNOWLEDGMENTS.md |
Adds contributor acknowledgment for the new Markdown link checks. |
.pre-commit-config.yaml |
Introduces the lychee hook configured for offline Markdown link checking. |
.github/workflows/pull_request.yml |
Renames the lint step and updates the failure message to include Markdown link checks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
This looks interesting, but: This is a third party and we don't build docs for this -- we shouldn't be checking this. These links do resolve -- they are cross doc package links, see: https://swiftpackageindex.com/ml-explore/mlx-swift/main/documentation/mlx |
|
Ah, I suppose this would require a gating mechanism or a mutli-repo checkout (overengineering?). I found .lycheeignore. I'll add the third-parties that resolve on swiftpackageindex.com/ml-explore. |
fe623f6 to
a6fce24
Compare
Proposed changes
Adds a markdown link check to the existing pre-commit workflow so repository-local links are validated locally and in pull request CI. Per review feedback, this now uses a small local script (
tools/check_links.py) instead of a third-party dependency — the same checker proposed in ml-explore/mlx-swift-examples#479; the two copies are kept in sync.python3 tools/check_links.py ..lycheeignoreis replaced by a.check-links-ignoreblocklist (fnmatch globs, repo-root relative). Patterns skip both scanned files and link targets, covering the review feedback:Source/Cmlx/fmt/*,Source/Cmlx/json/*,Source/Cmlx/metal-cpp/*(this also silences false positives like C++ lambdas[=](auto out)in fmt's docs being parsed as markdown links).mlx,mlxnn,mlxoptimizers) are not flagged — they resolve in the built documentation, not as repository files.MAINTENANCE.mdis not flagged.Unlike the examples repo (#479), no genuinely missing in-repo
.mdtargets turned up: running the checker with an empty.check-links-ignoreflags exactly the 7 links covered above — the fmt lambda and the six DocC cross-package links — all verified false positives, so there is nothing to track in issues here.Checklist
Put an
xin the boxes that apply.pre-commit run --all-filesto format my code / installed pre-commit prior to committing changesLocal run:
False-positive audit — with an empty
.check-links-ignore, the whole-tree scan flags only the known false positives, no real missing files: