MCPcopy Create free account
hub / github.com/RASAAS/docmcp-knowledge / _get_changed_slugs

Function _get_changed_slugs

scripts/validate_content_match.py:35–58  ·  view source on GitHub ↗

Get slugs for fulltext files changed in this PR (git diff vs base).

()

Source from the content-addressed store, hash-verified

33
34
35def _get_changed_slugs() -> set[str] | None:
36 """Get slugs for fulltext files changed in this PR (git diff vs base)."""
37 base_ref = os.environ.get("GITHUB_BASE_REF", "")
38 if not base_ref:
39 return None
40
41 try:
42 result = subprocess.run(
43 ["git", "diff", "--name-only", f"origin/{base_ref}...HEAD"],
44 capture_output=True, text=True, cwd=str(ROOT),
45 )
46 if result.returncode != 0:
47 return None
48
49 slugs = set()
50 for line in result.stdout.strip().split('\n'):
51 line = line.strip()
52 if line.startswith("nmpa/guidance/fulltext/") and line.endswith(".md"):
53 fname = line.split("/")[-1]
54 if not fname.endswith(".en.md"):
55 slugs.add(fname[:-3])
56 return slugs
57 except Exception:
58 return None
59
60
61def main():

Callers 1

mainFunction · 0.85

Calls 1

getMethod · 0.80

Tested by

no test coverage detected