From 3c3ca68041a7c1f26695f4a18e6590a688a36f7c Mon Sep 17 00:00:00 2001 From: Vaclav Petras Date: Sat, 15 Jun 2024 17:19:43 -0400 Subject: [PATCH] contributing: Hide bots in the GH API output (#3837) Hides bots also in the GitHub API release notes which have slightly different format and the bots don't have the bot suffix. Also fixes missing check for overflow list, so overflowing items were completely hidden. --- utils/generate_release_notes.py | 9 ++++++++- utils/known_bot_names.txt | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/utils/generate_release_notes.py b/utils/generate_release_notes.py index 3e6367d39cc..1c2e31ed11a 100755 --- a/utils/generate_release_notes.py +++ b/utils/generate_release_notes.py @@ -89,7 +89,14 @@ def print_category(category, changes, file=None): overflow = [] max_section_length = 25 for item in sorted(items): + # Relies on author being specified after the last "by". author = item.rsplit(" by ", maxsplit=1)[-1] + # Relies on author being specified as username. + if " " in author: + author = author.split(" ", maxsplit=1)[0] + if author.startswith("@"): + # We expect that to be always the case, but we test anyway. + author = author[1:] if author in known_bot_names or author.endswith("[bot]"): hidden.append(item) elif len(visible) > max_section_length: @@ -98,7 +105,7 @@ def print_category(category, changes, file=None): visible.append(item) for item in visible: print(f"* {item}", file=file) - if hidden: + if hidden or overflow: print("\n
") print(" Show more\n") for item in itertools.chain(overflow, hidden): diff --git a/utils/known_bot_names.txt b/utils/known_bot_names.txt index 99a0ff600bc..68d2c69cacb 100644 --- a/utils/known_bot_names.txt +++ b/utils/known_bot_names.txt @@ -1 +1,3 @@ osgeoweblate +renovate +github-actions