This is an automated email from the ASF dual-hosted git repository.

janhoy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/main by this push:
     new afb290d56aa Add more checks to the changelog validator (#3978)
afb290d56aa is described below

commit afb290d56aa0dde34fff54309c7d2922396aa571
Author: Jan Høydahl <[email protected]>
AuthorDate: Wed Dec 24 20:15:55 2025 +0100

    Add more checks to the changelog validator (#3978)
---
 .github/scripts/validate-changelog-yaml.py | 32 ++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/.github/scripts/validate-changelog-yaml.py 
b/.github/scripts/validate-changelog-yaml.py
index be1c9205cdb..5503872cf6b 100644
--- a/.github/scripts/validate-changelog-yaml.py
+++ b/.github/scripts/validate-changelog-yaml.py
@@ -22,10 +22,14 @@ Validates changelog YAML files in changelog/unreleased/ 
folder.
 
 Checks:
 - File is valid YAML
+- All top-level keys are valid (title, type, issues, links, important_notes, 
modules, authors)
+- Deprecated keys (merge_requests, configurations) are not used
 - Contains required 'title' field (non-empty string)
 - Contains required 'type' field (one of: added, changed, fixed, deprecated, 
removed, dependency_update, security, other)
 - Contains required 'authors' field with at least one author
 - Each author has a 'name' field (non-empty string)
+- Contains either 'links' or 'issues' field (or both)
+- If 'issues' is present, it must be an integer not exceeding 17000
 """
 
 import sys
@@ -35,6 +39,8 @@ import yaml
 def validate_changelog_yaml(file_path):
     """Validate a changelog YAML file."""
     valid_types = ['added', 'changed', 'fixed', 'deprecated', 'removed', 
'dependency_update', 'security', 'other']
+    valid_keys = ['title', 'type', 'issues', 'links', 'important_notes', 
'modules', 'authors']
+    deprecated_keys = ['merge_requests', 'configurations']
 
     try:
         with open(file_path, 'r', encoding='utf-8') as f:
@@ -45,6 +51,18 @@ def validate_changelog_yaml(file_path):
             print(f"::error file={file_path}::File must contain YAML mapping 
(key-value pairs)")
             return False
 
+        # Check for invalid top-level keys
+        for key in data.keys():
+            if key not in valid_keys and key not in deprecated_keys:
+                print(f"::error file={file_path}::Invalid top-level key 
'{key}'. Valid keys are: {', '.join(valid_keys)}")
+                return False
+
+        # Check for deprecated keys
+        for deprecated_key in deprecated_keys:
+            if deprecated_key in data:
+                print(f"::error file={file_path}::Our project does not use the 
'{deprecated_key}' yaml key, please remove")
+                return False
+
         # Validate 'title' field
         if 'title' not in data or not data['title']:
             print(f"::error file={file_path}::Missing or empty 'title' field")
@@ -88,6 +106,20 @@ def validate_changelog_yaml(file_path):
                 print(f"::error file={file_path}::Author {i} 'name' must be a 
non-empty string")
                 return False
 
+        # Validate that either 'links' or 'issues' exists (or both)
+        if 'links' not in data and 'issues' not in data:
+            print(f"::error file={file_path}::Must contain either 'links' or 
'issues' key (or both)")
+            return False
+
+        # Validate 'issues' field if present
+        if 'issues' in data:
+            if not isinstance(data['issues'], int):
+                print(f"::error file={file_path}::Field 'issues' must be an 
integer")
+                return False
+            if data['issues'] > 17000:
+                print(f"::error file={file_path}::Field 'issues' value 
{data['issues']} points to a non-existing github PR. Did you intend to 
reference a JIRA issue, please use 'links'.")
+                return False
+
         # All validations passed
         print(f"✓ {file_path} is valid")
         print(f"  Title: {data['title']}")

Reply via email to