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