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

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


The following commit(s) were added to refs/heads/branch_9x by this push:
     new 3d91a422fad Fix bugs in validate-changelog-yaml.py (#4414)
3d91a422fad is described below

commit 3d91a422fad5e8d693020293ac4c8bc09ae52339
Author: Jan Høydahl <[email protected]>
AuthorDate: Tue May 12 09:14:51 2026 +0200

    Fix bugs in validate-changelog-yaml.py (#4414)
    
    (cherry picked from commit 17747f3a3153202a334b6f2592d1b2915fd82e8b)
---
 .github/scripts/validate-changelog-yaml.py | 38 ++++++++++++++++++++++++++----
 1 file changed, 33 insertions(+), 5 deletions(-)

diff --git a/.github/scripts/validate-changelog-yaml.py 
b/.github/scripts/validate-changelog-yaml.py
index 5503872cf6b..e458a2be2fb 100644
--- a/.github/scripts/validate-changelog-yaml.py
+++ b/.github/scripts/validate-changelog-yaml.py
@@ -29,7 +29,9 @@ Checks:
 - 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
+- If 'issues' is present, it must be a list of integers not exceeding 17000
+- If 'links' is present, each entry must be a mapping with 'name' and 'url' 
fields (not a plain string)
+- Comment block is removed
 """
 
 import sys
@@ -113,12 +115,38 @@ def validate_changelog_yaml(file_path):
 
         # 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")
+            if not isinstance(data['issues'], list):
+                print(f"::error file={file_path}::Field 'issues' must be a 
list of integers")
                 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'.")
+            for i, issue in enumerate(data['issues']):
+                if not isinstance(issue, int):
+                    print(f"::error file={file_path}::Field 'issues' entry {i} 
must be an integer")
+                    return False
+                if issue > 17000:
+                    print(f"::error file={file_path}::Field 'issues' value 
{issue} points to a non-existing github PR. Did you intend to reference a JIRA 
issue, please use 'links'.")
+                    return False
+
+        # Validate 'links' field if present
+        if 'links' in data:
+            if not isinstance(data['links'], list):
+                print(f"::error file={file_path}::Field 'links' must be a 
list")
                 return False
+            for i, link in enumerate(data['links']):
+                if not isinstance(link, dict):
+                    print(f"::error file={file_path}::Link {i} must be a 
mapping with 'name' and 'url' fields, not a plain string")
+                    return False
+                if 'name' not in link or not link['name']:
+                    print(f"::error file={file_path}::Link {i} missing or 
empty 'name' field")
+                    return False
+                if not isinstance(link['name'], str) or not 
link['name'].strip():
+                    print(f"::error file={file_path}::Link {i} 'name' must be 
a non-empty string")
+                    return False
+                if 'url' not in link or not link['url']:
+                    print(f"::error file={file_path}::Link {i} missing or 
empty 'url' field")
+                    return False
+                if not isinstance(link['url'], str) or not link['url'].strip():
+                    print(f"::error file={file_path}::Link {i} 'url' must be a 
non-empty string")
+                    return False
 
         # All validations passed
         print(f"✓ {file_path} is valid")

Reply via email to