ci: catch broken markdown links#479
Conversation
9a5f2e7 to
1535b29
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds repository-local Markdown link validation by integrating the lychee link checker into the existing pre-commit workflow and ensuring it runs in pull request CI, helping prevent broken intra-repo documentation links (e.g., the missing Tools/image-tool/README.md link reported in #477).
Changes:
- Add a
lycheepre-commit hook (offline mode) to validate Markdown links without external network access. - Update the PR CI workflow step labeling/messaging to reflect link checks alongside style checks.
- Add contributor acknowledgment for the CI/link-check addition.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
ACKNOWLEDGMENTS.md |
Adds a new contributor entry related to link-checking changes. |
.pre-commit-config.yaml |
Adds a lychee hook to check Markdown links (offline) as part of pre-commit/CI. |
.github/workflows/pull_request.yml |
Updates lint job step name/message to include Markdown link checks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
@copilot open issues for all 4 broken links above using https://github.com/ml-explore/mlx-swift-examples/blob/main/.github/ISSUE_TEMPLATE/bug_report.md |
20413f3 to
2b3fc58
Compare
2b3fc58 to
e90bdcd
Compare
|
I like the idea, but I wonder if we can just do it with a local tool instead of a 3rd party dependency? I had claude throw something together: Is there something lychee gives that is missing here (especially in offline mode)? |
|
No it was just convenient and when Claude reinvented the wheel for me the regex was a bit unreadable. I totally understand the reluctance of relying on a third party tool though, especially from a security POV - hence the pinned version. |
6cfbaa3 to
ac4fcbc
Compare
@davidkoski updated PR to use local check_links.py - reused in ml-explore/mlx-swift#403 as well |
|
@copilot review PR again please |
2818ee7 to
a289cc8
Compare
|
Hah, it caught the issue in #485. I merged that so if you rebase this should run clean. |
|
once we get this set up, it would be great to have this in all the mlx-swift repos! |
|
@x-n2o OK, I think the issues that this detects are now fixed on main -- can you rebase and I will run CI again? Thanks! |
|
Now just failing on: MNIST -> MLXMNIST |
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 (
support/check_links.py, adapted from the one suggested in review) instead of a third-party dependency.python3 support/check_links.py ..check-links-ignoreblocklist (fnmatch globs, repo-root relative) covers prompt fixtures (Applications/LLMEval/Models/*) and the paths that moved to the mlx-swift-lm package (Libraries/MLXLLM/*,Libraries/Embedders/*).This helps prevent broken repository links like the missing
Tools/image-tool/README.mdentry reported in #477 (fixed by #481).The one genuinely broken in-repo link surfaced by the check is tracked separately:
Tools/mnist-tool/README.md→Libraries/MNIST/README.md, renamed toMLXMNISTin add VLM support, refactor common LM code into MLXLMCommon. breaking API changes #151 (fixed by docs(mnist-tool): fix link to renamed MLXMNIST README #485)Checklist
Put an
xin the boxes that apply.pre-commit run --all-filesto format my code / installed pre-commit prior to committing changesLocal run — the check correctly flags the link tracked in #484; once #485 lands this goes green: