Skip to content

Commit 232690c

Browse files
dsmileyjanhoy
andauthored
changelog: move entry advise into template (#4111)
And improve/clarify advise. Remove "security" as a type, which is orthogonal to the existing types. Co-authored-by: Jan Høydahl <janhoy@apache.org>
1 parent a0c686f commit 232690c

3 files changed

Lines changed: 46 additions & 27 deletions

File tree

.github/scripts/validate-changelog-yaml.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
- Each author has a 'name' field (non-empty string)
3131
- Contains either 'links' or 'issues' field (or both)
3232
- If 'issues' is present, it must be an integer not exceeding 17000
33+
- Comment block is removed
3334
"""
3435

3536
import sys
@@ -41,10 +42,12 @@ def validate_changelog_yaml(file_path):
4142
valid_types = ['added', 'changed', 'fixed', 'deprecated', 'removed', 'dependency_update', 'security', 'other']
4243
valid_keys = ['title', 'type', 'issues', 'links', 'important_notes', 'modules', 'authors']
4344
deprecated_keys = ['merge_requests', 'configurations']
45+
not_allowed_text = ['DELETE ALL COMMENTS UP HERE', 'Most such changes are too small']
4446

4547
try:
4648
with open(file_path, 'r', encoding='utf-8') as f:
47-
data = yaml.safe_load(f)
49+
raw_content = f.read()
50+
data = yaml.safe_load(raw_content)
4851

4952
# Check if file contains a mapping (dictionary)
5053
if not isinstance(data, dict):
@@ -120,6 +123,12 @@ def validate_changelog_yaml(file_path):
120123
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'.")
121124
return False
122125

126+
# Validate that comments are removed
127+
for not_allowed in not_allowed_text:
128+
if not_allowed in raw_content:
129+
print(f"::error file={file_path}::File still contains commented template text. Please remove the comment block at the top of the file.")
130+
return False
131+
123132
# All validations passed
124133
print(f"✓ {file_path} is valid")
125134
print(f" Title: {data['title']}")

dev-docs/changelog.adoc

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -78,25 +78,11 @@ user.githubid=johngithub
7878
user.asfid=johnapache
7979
----
8080

81-
TIP: Aliases for `writeChangelog` task are `changelog` and `newChangelog`.
82-
83-
== 4. Writing Good Entries
84-
85-
* **Audience** is end-users and administrators, not committers.
86-
* If the change is super minor, like a typo, don't bother adding a yaml file
87-
* Keep the entry short and focused on the user impact.
88-
* Choose the correct *type*:
89-
** `added` for new features
90-
** `changed` for improvements to existing code
91-
** `fixed` for bug fixes
92-
** `deprecated` for deprecated features
93-
** `removed` for code removed in major releases
94-
** `dependency_update` for updates to dependencies
95-
** `security` for security-related changes
96-
** `other` for anything else, like the build or documentation
97-
* Reference issues as `SOLR-12345` or GitHub `PR#123`.
98-
99-
== 5. Changelog Validation in Pull Requests
81+
The changelog has comments to help you fill it out. Remove them after filling out the form.
82+
83+
TIP: Aliases for the `writeChangelog` task are `changelog` and `newChangelog`.
84+
85+
== 4. Changelog Validation in Pull Requests
10086

10187
The `validate-changelog` GitHub workflow automatically checks that:
10288

@@ -105,9 +91,9 @@ The `validate-changelog` GitHub workflow automatically checks that:
10591

10692
If your change does not require a changelog entry, it is still possible to merge the PR.
10793

108-
== 6. For release managers
94+
== 5. For release managers
10995

110-
=== 6.1 Gradle tasks for logchange
96+
=== 5.1 Gradle tasks for logchange
11197

11298
The logchange gradle plugin offers some tasks, here are the two most important:
11399

@@ -129,7 +115,7 @@ The `logchangeRelease` and `logchangeGenerate` tasks are used by ReleaseWizard.
129115

130116
These are integrated in the Release Wizard.
131117

132-
=== 6.2 Migration tool
118+
=== 5.2 Migration tool
133119

134120
There is a migration tool in `dev-tools/scripts/changes2logchange.py` for one-time use during the transition.
135121
It will bulk convert the entire `solr/CHANGES.txt` file to files in the `changelog/` folder and versioned sub folders.
@@ -160,7 +146,7 @@ links:
160146
url: https://issues.apache.org/jira/browse/SOLR-17960
161147
----
162148

163-
=== 6.3 Changelog validation tool
149+
=== 5.3 Changelog validation tool
164150

165151
There is a tool `dev-tools/scripts/validateChangelogs.py` that will do a
166152
cross-branch validation of changelog folders. It takes no arguments and
@@ -245,7 +231,7 @@ Example report output (Json or Markdown):
245231
}
246232
----
247233

248-
== 7. Further Reading
234+
== 6. Further Reading
249235

250236
* https://github.com/logchange/logchange[Logchange web page]
251237
* https://keepachangelog.com/en/1.1.0/[keepachangelog.com website]

gradle/changelog.gradle

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,39 @@ task writeChangelog {
5454
def fileName = "changelog/unreleased/${sanitizedBranchName}.yml"
5555
def file = new File(fileName)
5656
file.parentFile.mkdirs()
57-
file.text = """# See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc
57+
file.text = """# (DELETE ALL COMMENTS UP HERE AFTER FILLING THIS IN
58+
59+
# See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc
60+
61+
# If the change is minor, don't bother adding a changelog entry.
62+
# For `other` type entries, the threshold to bother with a changelog entry should be even higher.
63+
64+
# title:
65+
# * The audience is end-users and administrators, not committers.
66+
# * Be short and focused on the user impact. Multiple sentences is fine!
67+
# * For technical/geeky details, prefer the commit message instead of changelog.
68+
# * Reference JIRA issues like `SOLR-12345`, or if no JIRA but have a GitHub PR then `PR#12345`.
69+
70+
# type:
71+
# `added` for new features/improvements, opt-in by the user typically documented in the ref guide
72+
# `changed` for improvements; not opt-in
73+
# `fixed` for improvements that are deemed to have fixed buggy behavior
74+
# `deprecated` for marking things deprecated
75+
# `removed` for code removed
76+
# `dependency_update` for updates to dependencies
77+
# `other` for anything else, like large/significant refactorings, build changes,
78+
# test infrastructure, or documentation.
79+
# Most such changes are too small/minor to bother with a changelog entry.
80+
5881
title: ${title}
59-
type: other # added, changed, fixed, deprecated, removed, dependency_update, security, other
82+
type:
6083
authors:
6184
- name: ${configuredName}${nick}${asfIdUrl}
6285
${jiraLinks}
6386
"""
6487

6588
println "Generated file: ${fileName} -- open and edit before committing"
89+
println "Read dev-docs/changelog.adoc if you don't contribute here often."
6690
}
6791
}
6892

0 commit comments

Comments
 (0)