@@ -40,11 +40,17 @@ def is_release_date(weekday, release_week_cycle, anchor_date):
40
40
return weeks_since_anchor % release_week_cycle == 0
41
41
42
42
43
- def is_changelog_empty (changelog_path ):
43
+ # Note that exceptions parameter can include changelog entries that are not considered "meaningful".
44
+ # That means that if Changelog consists ONLY of these entries, it is still considered empty.
45
+ def is_changelog_empty (changelog_path , exceptions = None ):
44
46
"""
45
47
Checks if the [Unreleased] section in the CHANGELOG.md contains meaningful entries.
46
48
It is considered "empty" if the section only contains headers (like ### Added) but no actual content.
47
49
"""
50
+
51
+ if exceptions is None :
52
+ exceptions = []
53
+
48
54
if not os .path .exists (changelog_path ):
49
55
raise FileNotFoundError (f"Changelog file not found at { changelog_path } " )
50
56
@@ -55,11 +61,28 @@ def is_changelog_empty(changelog_path):
55
61
# Then it matches in the first group all empty sections (only lines that are empty or start with ##)
56
62
# The second group matches the start of the next Changelog entry (## [).
57
63
# if both groups are matched it means that the Unreleased section is empty.
58
- pattern = re .compile (r"^## \[Unreleased\]\n((?:^###.*\n|^\s*\n)*)(^## \[)" , re .MULTILINE )
59
- match = pattern .search (content )
60
-
61
- # If we find a match for the "empty unreleased changelog entry" pattern, it means the changelog IS empty.
62
- return match
64
+ unreleased_match = re .search (r"^## \[Unreleased\][ \t]*\n((?:.*\n)*?)(?=^## \[)" , content , re .MULTILINE )
65
+
66
+ if not unreleased_match :
67
+ print ("Could not find [Unreleased] section in the changelog." )
68
+ return True # No [Unreleased] section found, treat as empty
69
+
70
+ unreleased_content = unreleased_match .group (1 )
71
+ # Split into lines and filter out headers and empty lines
72
+ entries = [line .strip () for line in unreleased_content .splitlines ()
73
+ if line .strip () and not line .strip ().startswith ("###" )]
74
+
75
+ # If no entries, changelog is empty
76
+ if not entries :
77
+ print ("The [Unreleased] section in the changelog is empty." )
78
+ return True
79
+
80
+ # If all entries are in exceptions, changelog is empty
81
+ if all (entry in exceptions for entry in entries ):
82
+ print ("The [Unreleased] section in the changelog has no meaningful entries (only exceptions)." )
83
+ return True
84
+
85
+ return False
63
86
64
87
65
88
def verifyReleaseConditions (config : ReleaseConfig ):
@@ -72,12 +95,15 @@ def verifyReleaseConditions(config: ReleaseConfig):
72
95
"""
73
96
74
97
error_messages = []
98
+ exceptions = [
99
+ "* Changed minimum Unity version supported to 2022.3 LTS"
100
+ ]
75
101
76
102
try :
77
103
if not is_release_date (config .release_weekday , config .release_week_cycle , config .anchor_date ):
78
104
error_messages .append (f"Condition not met: Today is not the scheduled release day. It should be weekday: { config .release_weekday } , every { config .release_week_cycle } weeks starting from { config .anchor_date } ." )
79
105
80
- if is_changelog_empty (config .changelog_path ):
106
+ if is_changelog_empty (config .changelog_path , exceptions ):
81
107
error_messages .append ("Condition not met: The [Unreleased] section of the changelog has no meaningful entries." )
82
108
83
109
if config .github_manager .is_branch_present (config .release_branch_name ):
0 commit comments