From 96ff20a322e70c72de275ad06504cb9e88ff2672 Mon Sep 17 00:00:00 2001 From: Adam Taylor Date: Thu, 14 Dec 2023 22:27:54 +0000 Subject: [PATCH] Add message if no modified entities --- monitor.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/monitor.py b/monitor.py index 6d74faf..2d00e69 100644 --- a/monitor.py +++ b/monitor.py @@ -125,7 +125,23 @@ def send_message_to_slack_blocks(webhook_url, blocks): enriched_data = enrich_count(count, syn) -slack_message_blocks = dataframe_to_slack_block_with_md_links(enriched_data) +# Check if the dataframe is empty +if enriched_data.empty: + # If no modified entities are found, prepare a simple message for Slack + slack_message_blocks = { + "blocks": [ + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "No entities were modified in the last day" + } + } + ] + } +else: + # If there are modified entities, format the message as before + slack_message_blocks = dataframe_to_slack_block_with_md_links(enriched_data) # Usage send_message_to_slack_blocks(webhook_url, slack_message_blocks)