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 fb74fa88d95 SOLR-17619 Cleanup after logchange cutover (#3820)
fb74fa88d95 is described below

commit fb74fa88d95efb97ea27ac64ec9e8e337dbd4bff
Author: Jan Høydahl <[email protected]>
AuthorDate: Thu Oct 30 03:31:23 2025 +0100

    SOLR-17619 Cleanup after logchange cutover (#3820)
    
    * SOLR-17619 Cleanup after logchange cutover
    * Exclude generated archive.md files from license checks
    * Fix generate-filename
    * Incorporate David's suggestion.
    * Fixes precommit
    
     Fixes #3818
---
 changelog/README.md                  |  7 +++----
 changelog/unreleased/PR#3778.yml     |  2 +-
 dev-docs/changelog.adoc              |  7 ++++---
 gradle/changelog.gradle              | 22 ++++++++++++++++------
 gradle/validation/rat-sources.gradle |  1 +
 5 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/changelog/README.md b/changelog/README.md
index 3686afdfec0..130c9a285d4 100644
--- a/changelog/README.md
+++ b/changelog/README.md
@@ -14,8 +14,7 @@
     See the License for the specific language governing permissions and
     limitations under the License.
  -->
-# New changelog process
+# Apache Solr Changelog
 
-We are in the process of migrating to a new way of managing our changelog. 
Please see [dev-docs/changelog.adoc](../dev-docs/changelog.adoc) for details.
-
-In a transition period it is still possible to merge your changelog entry to 
`solr/CHANGES.txt`, but then you can only use the new process.
+This is the home of the Solr changelog, in logchange format.
+Please see [dev-docs/changelog.adoc](../dev-docs/changelog.adoc) for details.
diff --git a/changelog/unreleased/PR#3778.yml b/changelog/unreleased/PR#3778.yml
index 42afbca44a9..96df91509cb 100644
--- a/changelog/unreleased/PR#3778.yml
+++ b/changelog/unreleased/PR#3778.yml
@@ -4,5 +4,5 @@ type: added # added, changed, fixed, deprecated, removed, 
dependency_update, sec
 authors:
   - name: Eric Pugh
   - name: Andreas Rütten
-merge_requests:
+issues:
   - 3778
diff --git a/dev-docs/changelog.adoc b/dev-docs/changelog.adoc
index 057b2e6604b..a89b522fcb9 100644
--- a/dev-docs/changelog.adoc
+++ b/dev-docs/changelog.adoc
@@ -30,13 +30,14 @@ solr/
 └── changelog/
     ├── unreleased/         ← new fragments live here
     |   └── SOLR-12345-fix-memory-leak.yml
-    ├── v10.0.0/            ← changes in already released version
-    └── v10.0.1/
+    ├── v9.8.0/            ← changes in already released versions
+    ├── v9.8.0/
+    └── v9.9.0/
 ----
 
 == 3. The YAML format
 
-Below is an example of a changelog yaml fragment. The full yaml format is 
xref:https://logchange.dev/tools/logchange/reference/#tasks[documented here], 
but we normally only need `title`, `type`, `authors` and `links`:
+Below is an example of a changelog yaml fragment. The full yaml format is 
xref:https://logchange.dev/tools/logchange/reference/#tasks[documented here], 
but we normally only need `title`, `type`, `authors` and `links`. For a change 
without a JIRA, you can add the PR number in `issues`:
 
 [source, yaml]
 ----
diff --git a/gradle/changelog.gradle b/gradle/changelog.gradle
index 6c5ea72e7bb..661c8cfb54f 100644
--- a/gradle/changelog.gradle
+++ b/gradle/changelog.gradle
@@ -25,23 +25,33 @@ logchange {
 task writeChangelog {
   description = 'Generates a change/log description file (YAML)'
   doLast {
+    def gitBranchFull = 'git rev-parse --abbrev-ref HEAD'.execute().text.trim()
+
+    // Prevent running on main or branches prefixed with 'branch_'
+    if (gitBranchFull == 'main' || gitBranchFull.startsWith('branch_')) {
+      throw new GradleException("Cannot create changelog on branch 
'${gitBranchFull}'. This task should only be run on feature branches.")
+    }
+
+    def gitBranch = gitBranchFull.replaceFirst(/^.*\//, "")
+
     def gitUserName = 'git config user.name'.execute().text.trim()
     def configuredName = 
providers.gradleProperty("user.name").getOrElse(gitUserName)
     def githubId = providers.gradleProperty("user.githubid").getOrElse(null)
     def nick = githubId ? "\n    nick: ${githubId}" : ""
     def asfId = providers.gradleProperty("user.asfid").getOrElse(null)
     def asfIdUrl = asfId ? "\n    url: 
https://home.apache.org/phonebook.html?uid=${asfId}"; : ""
-    def gitBranch = 'git rev-parse --abbrev-ref HEAD'.execute().text.trim()
-    def jiraMatcher = gitBranch.toUpperCase() =~ /SOLR-\d\d\d+/
-    def jiraRef = jiraMatcher ? jiraMatcher[0] : "SOLR-XXXX"
+    def jiraMatcher = gitBranch =~ /(?i)SOLR-\d\d\d+/
+    def jiraRef = jiraMatcher ? jiraMatcher[0].toUpperCase() : "SOLR-XXXX"
     def jiraUrl = "https://issues.apache.org/jira/browse/${jiraRef}";
     def jiraLinks = jiraMatcher ? "links:\n  - name: ${jiraRef}\n    url: 
${jiraUrl}" : ""
-    def branchWithoutJira = gitBranch.replaceFirst(/(?i)SOLR-\d\d\d+-/, 
"").replace("-", " ").capitalize()
-    def fileName = "changelog/unreleased/${gitBranch}.yml"
+    def title = gitBranch.replaceFirst(/(?i)SOLR-\d\d\d+-/, "").replace("-", " 
").capitalize()
+    // Strip everything before and including '/', then sanitize special 
characters
+    def sanitizedBranchName = gitBranch.replaceAll(/^.*\//, 
"").replaceAll(/[^a-zA-Z0-9._-]/, "-")
+    def fileName = "changelog/unreleased/${sanitizedBranchName}.yml"
     def file = new File(fileName)
     file.parentFile.mkdirs()
     file.text = """# See 
https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc
-title: ${branchWithoutJira}
+title: ${title}
 type: other # added, changed, fixed, deprecated, removed, dependency_update, 
security, other
 authors:
   - name: ${configuredName}${nick}${asfIdUrl}
diff --git a/gradle/validation/rat-sources.gradle 
b/gradle/validation/rat-sources.gradle
index 8f87dcb065d..90e7d3da5e3 100644
--- a/gradle/validation/rat-sources.gradle
+++ b/gradle/validation/rat-sources.gradle
@@ -100,6 +100,7 @@ allprojects {
                     exclude "CHANGELOG.md"
                     exclude "changelog/**/version-summary.md"
                     exclude "changelog/.templates/*.md"
+                    exclude "changelog/archive.md"
 
                     // The root project also includes patterns for the include 
composite
                     // projects. Include their sources in the scan.

Reply via email to