Skip to content

Commit 77d1ed2

Browse files
feat: Format output as Markdown for improved readability
This commit updates the `scripts/gha/get_pr_review_comments.py` script to format its entire output using Markdown. This significantly improves the readability and structure of the comment data when pasted into Markdown-aware systems. Changes include: - Comment attribution (user, ID, reply ID) is now an H3 heading with bolding and code formatting. - Metadata (Timestamp, Status, File, Line, URL) is presented as a Markdown bulleted list with bold labels and appropriate formatting for values (code ticks, links). - "Diff Hunk Context" and "Comment Body" are now H4 headings. - The diff hunk itself remains wrapped in triple backticks for code block rendering. - A Markdown horizontal rule (---) is used to separate individual comments. These changes make the script's output more organized and easier to parse visually.
1 parent 599845b commit 77d1ed2

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

scripts/gha/get_pr_review_comments.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -171,16 +171,15 @@ def main():
171171
comment_id = comment.get("id")
172172
in_reply_to_id = comment.get("in_reply_to_id")
173173

174-
print(f"Comment by: {user} (ID: {comment_id}){f' (In Reply To: {in_reply_to_id})' if in_reply_to_id else ''}")
174+
print(f"### Comment by: **{user}** (ID: `{comment_id}`){f' (In Reply To: `{in_reply_to_id}`)' if in_reply_to_id else ''}\n")
175175
if created_at_str:
176-
print(f"Timestamp: {created_at_str}")
176+
print(f"* **Timestamp**: `{created_at_str}`")
177+
print(f"* **Status**: `{status_text}`")
178+
print(f"* **File**: `{path}`")
179+
print(f"* **Line**: `{line_to_display}`") # Label changed from "Line in File Diff"
180+
print(f"* **URL**: <{html_url}>\n")
177181

178-
print(f"Status: {status_text}")
179-
print(f"File: {path}")
180-
print(f"Line in File Diff: {line_to_display}")
181-
print(f"URL: {html_url}")
182-
183-
print("--- Diff Hunk Context ---")
182+
print("#### Diff Hunk Context:")
184183
print("```") # Start of Markdown code block
185184
if diff_hunk and diff_hunk.strip():
186185
hunk_lines = diff_hunk.split('\n')
@@ -195,9 +194,9 @@ def main():
195194
print("(No diff hunk available for this comment)")
196195
print("```") # End of Markdown code block
197196

198-
print("--- Comment ---")
197+
print("#### Comment Body:")
199198
print(body)
200-
print("----------------------------------------\n")
199+
print("\n---")
201200

202201
if latest_created_at_obj:
203202
try:

0 commit comments

Comments
 (0)