Fix pipeline status check

This commit is contained in:
Radek Golan 2024-04-22 20:54:08 +02:00
parent 924360246b
commit 4c5f4a5312

View File

@ -5,7 +5,7 @@ from pprint import pprint
webhook = DiscordWebhook(environ["PLUGIN_WEBHOOK_URL"]) webhook = DiscordWebhook(environ["PLUGIN_WEBHOOK_URL"])
success = environ["CI_PIPELINE_STATUS"] != "failed" success = environ["CI_PIPELINE_STATUS"] != "failure"
webhook.username = "Woodpecker CI" webhook.username = "Woodpecker CI"
webhook.avatar_url = "https://ci.shielddagger.com/favicons/favicon-dark-success.png" if success else \ webhook.avatar_url = "https://ci.shielddagger.com/favicons/favicon-dark-success.png" if success else \
@ -13,7 +13,7 @@ webhook.avatar_url = "https://ci.shielddagger.com/favicons/favicon-dark-success.
webhook.add_embed(DiscordEmbed( webhook.add_embed(DiscordEmbed(
"Pipeline Failed" if not success else "Pipeline Succeeded", "Pipeline Failed" if not success else "Pipeline Succeeded",
color="ED4245" if environ["CI_PIPELINE_STATUS"] == "failed" else "57F287", color="ED4245" if not success else "57F287",
url=environ["CI_PIPELINE_URL"], url=environ["CI_PIPELINE_URL"],
timestamp=datetime.now(UTC), timestamp=datetime.now(UTC),
author={ author={