2121from services .comparison import ComparisonProxy
2222from services .decoration import Decoration
2323from services .license import is_properly_licensed
24- from services .notification .commit_notifications import store_notification_results
24+ from services .notification .commit_notifications import (
25+ create_or_update_commit_notification_from_notification_result ,
26+ store_notification_results ,
27+ )
2528from services .notification .notifiers import (
2629 StatusType ,
2730 get_all_notifier_classes_mapping ,
@@ -305,8 +308,6 @@ def notify(self, comparison: ComparisonProxy) -> list[IndividualResult]:
305308 for notifier in all_other_notifiers
306309 )
307310
308- store_notification_results (comparison , results )
309-
310311 return [
311312 IndividualResult (
312313 notifier = notifier .name , title = notifier .title , result = result
@@ -333,6 +334,7 @@ def notify_individual_notifier(
333334 }
334335
335336 log .info ("Attempting individual notification" , extra = log_extra )
337+ res : NotificationResult | None = None
336338 try :
337339 res = notifier .notify (
338340 comparison , status_or_checks_helper_text = status_or_checks_helper_text
@@ -349,7 +351,14 @@ def notify_individual_notifier(
349351 raise
350352 except Exception :
351353 log .exception ("Individual notifier failed" , extra = log_extra )
352- return notifier , None
354+ return notifier , res
355+ finally :
356+ if res is None or res .notification_attempted :
357+ # only running if there is no result (indicating some exception)
358+ # or there was an actual attempt
359+ create_or_update_commit_notification_from_notification_result (
360+ comparison , notifier , res
361+ )
353362
354363
355364def split_notifiers (
0 commit comments