ci(docs): scope link check to docs/ only (avoid legacy README links)

This commit is contained in:
Abhimanyu Saharan
2026-02-12 09:05:48 +00:00
parent d830918fd1
commit 879b50199f

View File

@@ -25,18 +25,20 @@ LINK_RE = re.compile(r"\[[^\]]+\]\(([^)]+)\)")
def iter_md_files(root: Path) -> list[Path]: def iter_md_files(root: Path) -> list[Path]:
patterns = [ """Return markdown files to check.
root / "README.md",
root / "CONTRIBUTING.md", Policy (initial): check only `docs/**/*.md`.
]
files: list[Path] = [] Rationale:
for p in patterns: - Root `README.md` / `CONTRIBUTING.md` may temporarily contain legacy links
if p.exists(): during docs re-org. Once docs + README are stabilized, we can expand this
files.append(p) to include root markdown files.
"""
docs = root / "docs" docs = root / "docs"
if docs.exists(): if not docs.exists():
files.extend(sorted(docs.rglob("*.md"))) return []
return files return sorted(docs.rglob("*.md"))
def normalize_target(raw: str) -> str | None: def normalize_target(raw: str) -> str | None: