fix(ci): stop treating markdown as frontend evidence-bearing code (#16693)

Co-authored-by: vasco <vasco.schiavo@protonmail.com>
This commit is contained in:
MarMar Labs
2026-08-19 07:31:20 +02:00
committed by GitHub
co-authored by vasco
parent 1916c9046c
commit 48038afbcc
2 changed files with 27 additions and 1 deletions
+5 -1
View File
@@ -57,6 +57,8 @@ FRONTEND_FILE_EXTENSIONS: tuple[str, ...] = (
".sass",
".less",
)
# Docs carry no visual state, so a screenshot can't evidence a change to them.
DOCUMENTATION_FILE_EXTENSIONS: tuple[str, ...] = (".md", ".mdx")
FRONTEND_CONFIG_GLOBS: tuple[str, ...] = (
"tailwind.config.*",
"vite.config.*",
@@ -155,9 +157,11 @@ def extract_human_note(body: str) -> str:
def is_frontend_file(path: str) -> bool:
"""Return True if a changed file should be treated as frontend code."""
normalized = path.lstrip("./")
lower = normalized.lower()
if lower.endswith(DOCUMENTATION_FILE_EXTENSIONS):
return False
if any(normalized.startswith(prefix) for prefix in FRONTEND_PATH_PREFIXES):
return True
lower = normalized.lower()
if any(lower.endswith(ext) for ext in FRONTEND_FILE_EXTENSIONS):
return True
name = normalized.split("/")[-1]
@@ -8,6 +8,8 @@ from unittest.mock import patch
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from check_pr_description import (
is_frontend_file,
touches_frontend,
extract_linked_issue_numbers,
extract_pr_type,
validate_linked_issue_ready,
@@ -222,3 +224,23 @@ https://youtube.com/watch?v=abc123
"""
errors = validate_bug_fix_evidence(body)
assert errors == []
def test_markdown_under_frontend_prefix_is_not_frontend():
assert not is_frontend_file("__tests__/router.md")
assert not is_frontend_file("src/notes.md")
assert not is_frontend_file("public/README.mdx")
def test_markdown_outside_frontend_prefix_still_not_frontend():
assert not is_frontend_file("docs/README.md")
def test_frontend_code_under_prefix_still_frontend():
assert is_frontend_file("src/app.tsx")
assert is_frontend_file("__tests__/routes/launch.test.tsx")
assert is_frontend_file("src/styles/main.css")
def test_docs_only_change_does_not_require_frontend_evidence():
assert not touches_frontend(["__tests__/router.md", "docs/README.md"])
def test_mixed_change_still_requires_frontend_evidence():
assert touches_frontend(["__tests__/router.md", "src/app.tsx"])