Skip to content

Commit 773db6b

Browse files
silehtclaude
andauthored
fix(ci): add warnings when MQ pull request body or metadata is missing (#985)
Log warnings instead of silently returning None when the merge queue pull request has no body or no Mergify metadata in fenced blocks. Co-Authored-By: Claude Opus 4.6 <[email protected]>
1 parent f49e38d commit 773db6b

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

mergify_cli/ci/queue/metadata.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import typing
44

5+
import click
56
import yaml
67

78
from mergify_cli import utils
@@ -54,8 +55,20 @@ def extract_from_event(ev: dict[str, typing.Any]) -> MergeQueueMetadata | None:
5455
return None
5556
if not title.startswith("merge queue: "):
5657
return None
57-
body = pr.get("body") or ""
58-
return _yaml_docs_from_fenced_blocks(body)
58+
body = pr.get("body")
59+
if not body:
60+
click.echo(
61+
"WARNING: MQ pull request without body, skipping metadata extraction",
62+
err=True,
63+
)
64+
return None
65+
ref = _yaml_docs_from_fenced_blocks(body)
66+
if ref is None:
67+
click.echo(
68+
"WARNING: MQ pull request body without Mergify metadata, skipping metadata extraction",
69+
err=True,
70+
)
71+
return ref
5972

6073

6174
def detect() -> MergeQueueMetadata | None:

0 commit comments

Comments
 (0)