Add support for icon URLs and include timestamps in embeds
This commit is contained in:
parent
9009552356
commit
f03b978506
@ -77,6 +77,7 @@ steps:
|
||||
woodpecker_url: https://ci.shielddagger.com
|
||||
woodpecker_token:
|
||||
from_secret: woodpecker_token
|
||||
icon_url: https://dev.shielddagger.com/repo-avatars/273e88fa2afde290121dc7b5987dc366b88325f147bf1e5766bca26296bbc1f9
|
||||
when:
|
||||
- status: [success, failure]
|
||||
|
||||
|
@ -28,5 +28,6 @@ steps:
|
||||
woodpecker_url: https://ci.shielddagger.com
|
||||
woodpecker_token:
|
||||
from_secret: woodpecker_token
|
||||
icon_url: https://dev.shielddagger.com/repo-avatars/273e88fa2afde290121dc7b5987dc366b88325f147bf1e5766bca26296bbc1f9
|
||||
when:
|
||||
- status: [success, failure]
|
||||
|
@ -1,4 +1,5 @@
|
||||
from os import environ
|
||||
from os import environ, getenv
|
||||
from datetime import datetime, UTC
|
||||
from discord_webhook import DiscordEmbed, DiscordWebhook
|
||||
from pprint import pprint
|
||||
|
||||
@ -14,6 +15,7 @@ webhook.add_embed(DiscordEmbed(
|
||||
"Pipeline Failed" if not success else "Pipeline Succeeded",
|
||||
color="ED4245" if environ["CI_PIPELINE_STATUS"] == "failed" else "57F287",
|
||||
url=environ["CI_PIPELINE_URL"],
|
||||
timestamp=datetime.now(UTC).isoformat(),
|
||||
author={
|
||||
"name": environ["CI_REPO"],
|
||||
"url": environ["CI_REPO_URL"]
|
||||
@ -22,6 +24,11 @@ webhook.add_embed(DiscordEmbed(
|
||||
"text": environ["CI_COMMIT_AUTHOR"],
|
||||
"icon_url": environ["CI_COMMIT_AUTHOR_AVATAR"]
|
||||
},
|
||||
thumbnail={
|
||||
"url": getenv("PLUGIN_ICON_URL"),
|
||||
"height": 0,
|
||||
"width": 0
|
||||
},
|
||||
fields=[{
|
||||
"name": "Commit",
|
||||
"value": f"[{environ['CI_COMMIT_SHA'][0:8]}]({environ['CI_REPO_URL']}/commit/{environ['CI_COMMIT_SHA']})",
|
||||
|
Loading…
x
Reference in New Issue
Block a user