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)
| 124 | |
| 125 | |
| 126 | def 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 | |
| 159 | def ensure_unreleased_gitkeep(git_root, dry_run=False): |
no test coverage detected
searching dependent graphs…