Skip to content

Commit 9ed1c05

Browse files
committed
Identify generated PR comments with the abench version
1 parent 58915ad commit 9ed1c05

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

‎src/abench/publishing.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from pathlib import Path
99
from xml.etree import ElementTree as ET
1010

11+
from . import __version__
1112
from .common import read_json, write_json
1213
from .report import COLORS, escape, load_run, memory_chart, runtime_chart
1314

@@ -175,6 +176,8 @@ def build_bundle(root):
175176
marker,
176177
"## abench results",
177178
"",
179+
f"Auto-generated by **abench {__version__}**.",
180+
"",
178181
f"PR: {config['repository']}#{config['pr']} · Baseline: {cell(config['baseline'])}",
179182
]
180183
snapshot = plan.get("publication_pr", {})

‎tests/test_publishing.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ def test_bundle_uses_real_results(tmp_path, monkeypatch):
9090
assert cli.main(["publish", str(root), "--dry-run"]) == 0
9191
bundle = root / "publication"
9292
body = (bundle / "comment.md").read_text()
93+
assert f"Auto-generated by **abench {publishing.__version__}**." in body
9394
assert "-20.0%" in body and "NOT RUN / NO RESULTS" in body
9495
assert SNAPSHOT["headRefOid"] in body and "a" * 40 in body
9596
for name in ("memory.svg", "runtimes.svg"):
@@ -152,6 +153,7 @@ def test_post_and_repeat_are_idempotent(tmp_path, monkeypatch):
152153
assert len(posts) == 1
153154
assert posts[0].count("--attach") == 2
154155
upload = Path(posts[0][posts[0].index("--body-file") + 1]).read_text()
156+
assert f"Auto-generated by **abench {publishing.__version__}**." in upload
155157
assert "PR head has changed" in upload
156158
assert "./memory.svg" in upload
157159
state = read_json(root / "publication/state.json")

0 commit comments

Comments
 (0)