Update notification messages format

Update notification messages format to use Emojis with:
* Discord
* Gotify
* Ntfy
This commit is contained in:
Mahmoud Osama
2025-05-04 19:59:39 +03:00
parent 83cfd9a2f1
commit 246b727d0a
4 changed files with 13 additions and 15 deletions

View File

@@ -27,9 +27,9 @@ def github_send_to_discord(releases, webhook_url):
logger.info(f"The version of {app_name} has not changed. No notification sent.") logger.info(f"The version of {app_name} has not changed. No notification sent.")
continue # Move on to the next application continue # Move on to the next application
message = f"New version: {version_number}\nFor: {app_name}\nPublished on: {release_date}\nChangelog:\n{changelog}\n{app_url}" message = f"📌 *New version*: {version_number}\n\n📦*For*: {app_name}\n\n📅 *Published on*: {release_date}\n\n📝 *Changelog*:\n\n```{changelog}```"
if len(message) > 2000: if len(message) > 2000:
message = f"New version: {version_number}\nFor: {app_name}\nPublished on: {release_date}\nFull changelog: {app_url}" message = f"📌 *New version*: {version_number}\n\n📦*For*: {app_name}\n\n📅 *Published on*: {release_date}\n\n🔗 *Release Link*: {app_url}"
# Updating the previous version for this application # Updating the previous version for this application
cursor.execute( cursor.execute(
"INSERT OR REPLACE INTO versions (repo, version, changelog) VALUES (?, ?, ?)", "INSERT OR REPLACE INTO versions (repo, version, changelog) VALUES (?, ?, ?)",
@@ -67,9 +67,7 @@ def docker_send_to_discord(releases, webhook_url):
logger.info(f"The digest of {app_name} has not changed. No notification sent.") logger.info(f"The digest of {app_name} has not changed. No notification sent.")
continue continue
message = f"New version for {app_name}\nDigest: {digest_number}\nPublished on: {release_date}\n{app_url}" message = f"🐳 *Docker Image Updated!*\n\n🔐 *New Digest*: `{digest_number}`\n\n📦 *App*: {app_name}\n\n📢*Published*: {release_date}\n\n🔗 *Link*: {app_url}"
if len(message) > 2000:
message = f"New version for {app_name}\nDigest: {digest_number}\nPublished on: {release_date}\nFull details: {app_url}"
cursor.execute( cursor.execute(
"INSERT OR REPLACE INTO docker_versions (repo, digest) VALUES (?, ?)", "INSERT OR REPLACE INTO docker_versions (repo, digest) VALUES (?, ?)",

View File

@@ -34,7 +34,7 @@ def github_send_to_gotify(releases, token, url):
logger.info(f"The version of {app_name} has not changed. No notification sent.") logger.info(f"The version of {app_name} has not changed. No notification sent.")
continue # Move on to the next application continue # Move on to the next application
message = f"New version: {version_number}\nFor: {app_name}\nPublished on: {release_date}\nChangelog:\n{changelog}\n{app_url}" message = f"📌 *New version*: {version_number}\n\n📦*For*: {app_name}\n\n📅 *Published on*: {release_date}\n\n📝 *Changelog*:\n\n```{changelog}```\n\n🔗 *Release Url*:{app_url}"
# Updating the previous version for this application # Updating the previous version for this application
cursor.execute( cursor.execute(
"INSERT OR REPLACE INTO versions (repo, version, changelog) VALUES (?, ?, ?)", "INSERT OR REPLACE INTO versions (repo, version, changelog) VALUES (?, ?, ?)",
@@ -77,7 +77,7 @@ def docker_send_to_gotify(releases, token, url):
logger.info(f"The digest of {app_name} has not changed. No notification sent.") logger.info(f"The digest of {app_name} has not changed. No notification sent.")
continue # Move on to the next application continue # Move on to the next application
message = f"New version: {digest_number}\nFor: {app_name}\nPublished on: {release_date}\n{app_url}" message = f"🐳 *Docker Image Updated!*\n\n🔐 *New Digest*: `{digest_number}`\n\n📦 *App*: {app_name}\n\n📢 *Published*: {release_date}\n\n🔗 *Release Url*:{app_url}"
# Updating the previous digest for this application # Updating the previous digest for this application
cursor.execute( cursor.execute(
"INSERT OR REPLACE INTO docker_versions (repo, digest) VALUES (?, ?, ?)", "INSERT OR REPLACE INTO docker_versions (repo, digest) VALUES (?, ?, ?)",

View File

@@ -32,7 +32,7 @@ def github_send_to_ntfy(releases, auth, url):
logger.info(f"The version of {app_name} has not changed. No notification sent.") logger.info(f"The version of {app_name} has not changed. No notification sent.")
continue # Move on to the next application continue # Move on to the next application
message = f"New version: {version_number}\nFor: {app_name}\nPublished on: {release_date}\nChangelog:\n{changelog}\n{app_url}" message = f"📌 *New version*: {version_number}\n\n📦*For*: {app_name}\n\n📅 *Published on*: {release_date}\n\n📝 *Changelog*:\n\n```{changelog}```\n\n 🔗 *Release Url*: {app_url}"
# Updating the previous version for this application # Updating the previous version for this application
cursor.execute( cursor.execute(
"INSERT OR REPLACE INTO versions (repo, version, changelog) VALUES (?, ?, ?)", "INSERT OR REPLACE INTO versions (repo, version, changelog) VALUES (?, ?, ?)",
@@ -75,7 +75,7 @@ def docker_send_to_ntfy(releases, auth, url):
logger.info(f"The digest of {app_name} has not changed. No notification sent.") logger.info(f"The digest of {app_name} has not changed. No notification sent.")
continue # Move on to the next application continue # Move on to the next application
message = f"New version: {digest_number}\nFor: {app_name}\nPublished on: {release_date}\n{app_url}" message = f"🐳 *Docker Image Updated!*\n\n🔐 *New Digest*: `{digest_number}`\n\n📦 *App*: {app_name}\n\n📢*Published*: {release_date}\n\n 🔗 *Release Url*: {app_url}"
# Updating the previous digest for this application # Updating the previous digest for this application
cursor.execute( cursor.execute(
"INSERT OR REPLACE INTO docker_versions (repo, digest) VALUES (?, ?, ?)", "INSERT OR REPLACE INTO docker_versions (repo, digest) VALUES (?, ?, ?)",
@@ -85,10 +85,10 @@ def docker_send_to_ntfy(releases, auth, url):
headers = { headers = {
"Authorization": f"Basic {auth}", "Authorization": f"Basic {auth}",
"Title": f"New version for {app_name}", "Title": f"🆕 New version for {app_name}",
"Priority": "urgent", "Priority": "urgent",
"Markdown": "yes", "Markdown": "yes",
"Actions": f"view, Update {app_name}, {app_url}, clear=true", "Actions": f"View, Update {app_name}, {app_url}, clear=true",
} }
response = requests.post(f"{url}", headers=headers, data=message) response = requests.post(f"{url}", headers=headers, data=message)
if response.status_code == 200: if response.status_code == 200:

View File

@@ -29,7 +29,7 @@ def github_send_to_slack(releases, webhook_url):
message = f"📌 *New version*: {version_number}\n\n📦*For*: {app_name}\n\n📅 *Published on*: {release_date}\n\n📝 *Changelog*:\n\n```{changelog}```" message = f"📌 *New version*: {version_number}\n\n📦*For*: {app_name}\n\n📅 *Published on*: {release_date}\n\n📝 *Changelog*:\n\n```{changelog}```"
if len(message) > 2000: if len(message) > 2000:
message = f"📌 *New version*: {version_number}\n\n📦*For*: {app_name}\n\n📅 *Published on*: {release_date}\n\n📝 *Changelog*:\n\n `check url since the changelog is huge`" message = f"📌 *New version*: {version_number}\n\n📦*For*: {app_name}\n\n📅 *Published on*: {release_date}\n\n📝 *Changelog*:\n\n `truncated..` use 🔗 instead "
cursor.execute( cursor.execute(
"INSERT OR REPLACE INTO versions (repo, version, changelog) VALUES (?, ?, ?)", "INSERT OR REPLACE INTO versions (repo, version, changelog) VALUES (?, ?, ?)",
@@ -50,7 +50,7 @@ def github_send_to_slack(releases, webhook_url):
"type": "button", "type": "button",
"text": { "text": {
"type": "plain_text", "type": "plain_text",
"text": "🔗 Changelog url" "text": "🔗 Release Url"
}, },
"url": f"{app_url}", "url": f"{app_url}",
"action_id": "button-action" "action_id": "button-action"
@@ -87,7 +87,7 @@ def docker_send_to_slack(releases, webhook_url):
logger.info(f"The digest of {app_name} has not changed. No notification sent.") logger.info(f"The digest of {app_name} has not changed. No notification sent.")
continue continue
message = f"🐳 *Docker Image Updated!*\n\n🔐 *New Digest*: `{digest_number}`\n\n📦 *App*: {app_name}\n\n*Published*: {release_date}" message = f"🐳 *Docker Image Updated!*\n\n🔐 *New Digest*: `{digest_number}`\n\n📦 *App*: {app_name}\n\n📢*Published*: {release_date}"
cursor.execute( cursor.execute(
"INSERT OR REPLACE INTO docker_versions (repo, digest) VALUES (?, ?)", "INSERT OR REPLACE INTO docker_versions (repo, digest) VALUES (?, ?)",
@@ -107,7 +107,7 @@ def docker_send_to_slack(releases, webhook_url):
"type": "button", "type": "button",
"text": { "text": {
"type": "plain_text", "type": "plain_text",
"text": "🔗 Changelog url" "text": "🔗 Release Url"
}, },
"url": f"{app_url}", "url": f"{app_url}",
"action_id": "button-action" "action_id": "button-action"