From 68423726c625649dd35b5c8018c752dbb72e5be2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Tue, 7 Jan 2025 17:05:15 +0100 Subject: [PATCH] fix: Don't output empty change for removed objects when using GitHub output format (check command) Issue-349: https://github.com/mkdocstrings/griffe/issues/349 --- src/_griffe/diff.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/_griffe/diff.py b/src/_griffe/diff.py index 7217d856..9e9fb087 100644 --- a/src/_griffe/diff.py +++ b/src/_griffe/diff.py @@ -219,10 +219,10 @@ def _explain_github(self) -> str: title = f"title={self._format_title()}" explanation = f"::warning {location},{title}::{self.kind.value}" old = self._format_old_value() - if old != "unset": + if old and old != "unset": old = f"`{old}`" new = self._format_new_value() - if new != "unset": + if new and new != "unset": new = f"`{new}`" if old and new: change = f"{old} -> {new}"