Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions gradle/changelog.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ task writeChangelog {
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 gitBranch = 'git rev-parse --abbrev-ref HEAD'.execute().text.trim().replaceFirst(/^.*\//, "")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this specific line is the substance. I also tweaked some other things...

def jiraMatcher = gitBranch =~ /(?i)SOLR-\d\d\d+/
def jiraRef = jiraMatcher ? jiraMatcher[0].toUpperCase() : "SOLR-XXXX"
Comment on lines +35 to +36
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the same regexp as further below; case insensitive match. then normalize what we find to uppercase

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 title = gitBranch.replaceFirst(/(?i)SOLR-\d\d\d+-/, "").replace("-", " ").capitalize()
def fileName = "changelog/unreleased/${gitBranch}.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}
Expand Down