Fix attachments

Attachments were still being sent by the wrong webhook
Attachments now have the `ansi` extension (text coloring)
This commit is contained in:
Radek Golan 2024-04-24 15:16:16 +02:00
parent d5491731f4
commit 9b61263254

View File

@ -68,6 +68,8 @@ webhook.add_embed(DiscordEmbed(
try:
if not success:
logfile_webhook = DiscordWebhook(environ["PLUGIN_WEBHOOK_URL"], rate_limit_retry=True)
logfile_webhook.username = "Woodpecker CI"
logfile_webhook.avatar_url = "https://ci.shielddagger.com/favicons/favicon-dark-error.png"
with APISession(environ["PLUGIN_WOODPECKER_URL"].rstrip("/")) as client:
client.headers.setdefault("Authorization", f"Bearer {environ["PLUGIN_WOODPECKER_TOKEN"]}")
@ -86,7 +88,7 @@ try:
logdata = b""
for logline in loginfo:
logdata += b64decode(logline["data"])
webhook.add_file(logdata, f"{step['name']}.log")
logfile_webhook.add_file(logdata, f"{step['name']}.ansi")
except KeyError:
webhook.add_embed(DiscordEmbed(
"API Error",