MCPcopy Create free account
hub / github.com/apache/solr / validate_unreleased_yamls

Function validate_unreleased_yamls

dev-tools/scripts/logchange.py:126–156  ·  view source on GitHub ↗

Run validate-changelog-yaml.py over changelog/unreleased/. Passes the folder path to the validator, which handles file discovery itself. Locates the validator relative to this script so it works regardless of cwd. If the validator cannot be found, logs a warning and returns True (procee

(git_root, dry_run=False)

Source from the content-addressed store, hash-verified

124
125
126def validate_unreleased_yamls(git_root, dry_run=False):
127 """Run validate-changelog-yaml.py over changelog/unreleased/.
128
129 Passes the folder path to the validator, which handles file discovery itself.
130 Locates the validator relative to this script so it works regardless of cwd.
131 If the validator cannot be found, logs a warning and returns True (proceed).
132 Returns True if all files are valid (or nothing to validate), False otherwise.
133 """
134 unreleased_dir = git_root / "changelog" / "unreleased"
135 if not unreleased_dir.exists():
136 return True
137
138 validator = Path(__file__).parent / "validate-changelog-yaml.py"
139 if not validator.exists():
140 print(f" Warning: validator not found at {validator} — skipping YAML validation")
141 return True
142
143 print(f"\n[0] Validating changelog/unreleased/ with {validator.name}")
144 if dry_run:
145 print(f" (dry-run) would run: {validator.name} {unreleased_dir}")
146 return True
147
148 result = subprocess.run(
149 [sys.executable, str(validator), str(unreleased_dir)],
150 cwd=git_root,
151 )
152 if result.returncode != 0:
153 print("\nError: changelog YAML validation failed — please fix the issues and run again.",
154 file=sys.stderr)
155 return False
156 return True
157
158
159def ensure_unreleased_gitkeep(git_root, dry_run=False):

Callers 1

cmd_prepareFunction · 0.85

Calls 2

existsMethod · 0.65
runMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…