Skip to content

Commit e861487

Browse files
committed
fix: update GHA notice to new format
Change-Id: I25371159566cc2de1cefd621d5f264336bb781a6
1 parent 2ff3496 commit e861487

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

mergify_cli/ci/junit.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ class InvalidJunitXMLError(Exception):
3434

3535

3636
async def junit_to_spans(
37-
trace_id: int,
3837
xml_content: bytes,
3938
test_language: str | None = None,
4039
test_framework: str | None = None,
@@ -82,6 +81,8 @@ async def junit_to_spans(
8281

8382
resource = resources.Resource.create(resource_attributes)
8483

84+
trace_id = ID_GENERATOR.generate_trace_id()
85+
8586
for testsuite in testsuites:
8687
min_start_time = now
8788
suite_name = testsuite.get("name", "unnamed testsuite")

mergify_cli/ci/upload.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ def _upload(
5757

5858
def connect_traces(spans: list[ReadableSpan]) -> None:
5959
if detector.get_ci_provider() == "github_actions" and spans:
60-
trace_id = spans[0].context.trace_id
60+
root_span_id = spans[0].context.span_id
6161
console.print(
62-
f"::notice title=Mergify CI::MERGIFY_TRACE_ID={trace_id}",
62+
f"::notice title=Mergify CI::MERGIFY_TEST_ROOT_SPAN_ID={root_span_id}",
6363
soft_wrap=True,
6464
)
6565

@@ -74,13 +74,10 @@ async def upload( # noqa: PLR0913, PLR0917
7474
) -> None:
7575
spans = []
7676

77-
trace_id = junit.ID_GENERATOR.generate_trace_id()
78-
7977
for filename in files:
8078
try:
8179
spans.extend(
8280
await junit.junit_to_spans(
83-
trace_id,
8481
pathlib.Path(filename).read_bytes(),
8582
test_language=test_language,
8683
test_framework=test_framework,

mergify_cli/tests/ci/test_junit.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ async def test_parse(
2323
) -> None:
2424
filename = pathlib.Path(__file__).parent / "junit_example.xml"
2525
spans = await junit.junit_to_spans(
26-
123,
2726
filename.read_bytes(),
2827
"python",
2928
"unittest",

mergify_cli/tests/ci/test_upload.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,13 @@ async def test_junit_upload(
6161

6262
captured = capsys.readouterr()
6363
if env["GITHUB_ACTIONS"] == "true":
64-
assert re.search(
65-
r"^::notice title=Mergify CI::MERGIFY_TRACE_ID=\d+",
64+
matched = re.search(
65+
r"^::notice title=Mergify CI::MERGIFY_TEST_ROOT_SPAN_ID=(\d+)",
6666
captured.out,
6767
re.MULTILINE,
6868
)
69+
assert matched is not None
70+
assert int(matched.group(1)) > 0
6971
else:
7072
assert "🎉 File(s) uploaded" in captured.out
7173

0 commit comments

Comments
 (0)