diff --git a/.github/scripts/update_readme/update_readme.py b/.github/scripts/update_readme/update_readme.py
index 5630a01..b1d0cdb 100644
--- a/.github/scripts/update_readme/update_readme.py
+++ b/.github/scripts/update_readme/update_readme.py
@@ -44,16 +44,31 @@ def generate_status_svg(label_text, label_color, count):
return svg
-def generate_discussion_svg(title, emoji, labels, category, upvotes, comments, author, created_at, last_comment_by, last_comment_at, discussion_url):
+def generate_discussion_svg(title, emoji, labels, category, upvotes, comments, author, created_at, last_comment_by, last_comment_at, discussion_url, participants):
width = 820
height = 120
+
+ # Emoji
emoji_size = 20 # 16 font size equal 20x19 px
emoji_box_x = 30
emoji_box_size = 54
+
+ # Upvotes
upvote_width = len(str(upvotes)) * 10 + 30
- upvote_x_center = 760
+ upvote_x_center = 768
upvote_rect_x = upvote_x_center - upvote_width / 2
+ # Comments
+ comment_width = len(str(comments)) * 10 + 20
+ comment_x_center = 768
+ comment_rect_x = comment_x_center - comment_width / 2
+
+ # Profile pictures
+ profile_size = 40
+ profile_gap = 20
+ profile_x = 710
+ profile_y = height / 2
+
# Format dates
created_at_formatted = datetime.strptime(created_at, "%Y-%m-%dT%H:%M:%SZ").strftime("%d %b %Y")
last_comment_at_formatted = (
@@ -73,6 +88,9 @@ def generate_discussion_svg(title, emoji, labels, category, upvotes, comments, a
+
+
+
@@ -111,13 +129,28 @@ def generate_discussion_svg(title, emoji, labels, category, upvotes, comments, a
-
+
{comments}
-
"""
+ # Render participant avatars
+ svg += """
+
+ """
+ for participant in participants[:10]:
+ svg += f"""
+
+
+
+
+ """
+ profile_x -= profile_gap
+ svg += """
+
+ """
+
return svg
def update_svgs():
@@ -138,18 +171,20 @@ def update_svgs():
createdAt
updatedAt
upvoteCount
- comments(first: 10) {
+ comments(first: 20) {
totalCount
nodes {
author {
login
+ avatarUrl(size: 40)
}
createdAt
- replies(first: 10) {
+ replies(first: 20) {
totalCount
nodes {
author {
login
+ avatarUrl(size: 40)
}
createdAt
}
@@ -167,6 +202,7 @@ def update_svgs():
}
author {
login
+ avatarUrl(size: 40)
}
}
}
@@ -231,6 +267,14 @@ def update_svgs():
break
print(f"Generating SVG for: {discussion['title']}")
+ # List all participants
+ participants = {}
+ participants[discussion['author']['login']] = discussion['author']['avatarUrl']
+ for comment in discussion['comments']['nodes']:
+ participants[comment['author']['login']] = comment['author']['avatarUrl']
+ for reply in comment['replies']['nodes']:
+ participants[reply['author']['login']] = reply['author']['avatarUrl']
+
# Calculate total comments (including replies)
total_comments = 0
last_comment_by = None
@@ -268,7 +312,8 @@ def update_svgs():
created_at=discussion['createdAt'],
last_comment_by=last_comment_by,
last_comment_at=last_comment_at,
- discussion_url=discussion['url']
+ discussion_url=discussion['url'],
+ participants=list(participants.values())
)
# Save each SVG to a unique file