From 57ce2c48b82cd264b7c6e0cce07e768e8bbeee64 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Thu, 20 Mar 2025 14:28:58 -0700 Subject: [PATCH] fix: round GitHub stars to whole numbers in HTML output --- scripts/badges.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/badges.py b/scripts/badges.py index 67a9210c1..a7a1b7cd8 100755 --- a/scripts/badges.py +++ b/scripts/badges.py @@ -205,7 +205,17 @@ def get_badges_html(): # Format values downloads_formatted = format_number(total_downloads) - stars_formatted = format_number(stars) if stars is not None else "0" + # Stars should be rounded to whole numbers + if stars is None: + stars_formatted = "0" + elif stars >= 1_000_000_000: + stars_formatted = f"{stars // 1_000_000_000}B" + elif stars >= 1_000_000: + stars_formatted = f"{stars // 1_000_000}M" + elif stars >= 1_000: + stars_formatted = f"{stars // 1_000}K" + else: + stars_formatted = str(stars) aider_percent_rounded = round(percentage) # Generate HTML badges