Skip to content

Commit 5838d3a

Browse files
committed
fix: convert relative image paths to absolute URLs in PR comments
1 parent 8b22e29 commit 5838d3a

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

.github/scripts/comment_pr.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,15 @@ def main():
105105
# Read the benchmark report generated in the previous step of the workflow
106106
if os.path.exists("filter_benchmark_report.md"):
107107
with open("filter_benchmark_report.md", "r") as f:
108-
benchmark_report = f.read()
108+
report_content = f.read()
109+
sha = os.environ.get("GITHUB_SHA")
110+
if repo and sha:
111+
# Make image paths absolute so they render in the PR comment
112+
# Using raw.githubusercontent.com for reliable rendering
113+
report_content = report_content.replace("](.github/images", f"](https://raw.githubusercontent.com/{repo}/{sha}/.github/images")
114+
109115
# Wrap the report in a details block
110-
benchmark_report = f"### Technical Benchmark Summary\n\n<details>\n<summary>📊 View Benchmark Details</summary>\n\n{benchmark_report}\n\n</details>"
116+
benchmark_report = f"### Technical Benchmark Summary\n\n<details>\n<summary>📊 View Benchmark Details</summary>\n\n{report_content}\n\n</details>"
111117

112118
status_emoji = "🚀" if failures == 0 else "❌"
113119

0 commit comments

Comments
 (0)