Skip to content

Commit

Permalink
Merge pull request #129 from dhis2/app_release_notes
Browse files Browse the repository at this point in the history
tweaks
  • Loading branch information
Philip-Larsen-Donnelly committed Sep 28, 2023
2 parents 31d0ac7 + 0416456 commit d6cd4e8
Show file tree
Hide file tree
Showing 3 changed files with 640 additions and 750 deletions.
19 changes: 13 additions & 6 deletions tools/app-release-notes/generate_app_notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@

# Configuration
categories_config = {
"feat[^:]*:": "Features",
"fix[^:]*:": "Bug Fixes",
"test[^:]*:": "Testing",
"ci[^:]*:": "Build Updates",
"feat": "Features",
"fix": "Bug Fixes",
"test": "Testing",
# "ci": "Build Updates",
# "docs": "Documentation",
# "refactor": "Refactoring",
"perf": "Performance",
# "chore": "Maintenance",
}
# apps = ["data-visualizer-app"]
base_url = "https://api.github.com/repos/dhis2"
Expand Down Expand Up @@ -58,8 +62,11 @@ def fetch_and_categorize_commits(app, from_tag, to_tag):
raw_message = commit['commit']['message']
for line in raw_message.split('\n'):
for pattern, category in categories_config.items():
if re.search(pattern, line, re.I):
processed_line = re.sub('^[^:]*'+pattern, '', line, flags=re.I).strip()
full_pattern = '^[* ]*'+pattern+'(:|\([^:]+\):)'
if re.search(full_pattern, line, re.I):
match = re.search(r'\(([^)]+)\):', line)
replacement = match.group(1)+':' if match else ''
processed_line = re.sub(full_pattern, replacement, line, flags=re.I).strip()
categories.setdefault(category, set()).add(processed_line)

# Filter out substrings
Expand Down
2 changes: 1 addition & 1 deletion website/content/resources/js/apprn.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function displayCommits() {
const categories = appData[version];

// Display a heading for the current version
messagesDiv.innerHTML += `<h2>${version}</h2>`;
messagesDiv.innerHTML += `<h2><a href="https://github.com/dhis2/${app}/releases/tag/${version}">${version}</a></h2>`;

// Format and add the categorized commit messages to the output
for (const [category, messages] of Object.entries(categories)) {
Expand Down
Loading

0 comments on commit d6cd4e8

Please sign in to comment.