diff --git a/src/discord_notifier/__main__.py b/src/discord_notifier/__main__.py index be98723..ce33c2a 100644 --- a/src/discord_notifier/__main__.py +++ b/src/discord_notifier/__main__.py @@ -20,7 +20,7 @@ class APISession(Session): url = self.base_url + url return super().request(method, url, *args, **kwargs) - +logfile_webhook = None webhook = DiscordWebhook(environ["PLUGIN_WEBHOOK_URL"], rate_limit_retry=True) success = environ["CI_PIPELINE_STATUS"] != "failure" @@ -67,6 +67,7 @@ webhook.add_embed(DiscordEmbed( try: if not success: + logfile_webhook = DiscordWebhook(environ["PLUGIN_WEBHOOK_URL"], rate_limit_retry=True) with APISession(environ["PLUGIN_WOODPECKER_URL"].rstrip("/")) as client: client.headers.setdefault("Authorization", f"Bearer {environ["PLUGIN_WOODPECKER_TOKEN"]}") @@ -101,4 +102,8 @@ except KeyError: )) pprint(webhook.json) -webhook.execute() +webhook.execute() + +if logfile_webhook is not None: + pprint(logfile_webhook.json) + logfile_webhook.execute()