ci: add version to tg msg (#75)

This commit is contained in:
Ylarod
2023-01-16 18:15:35 +08:00
committed by GitHub
parent bf3edfd0ef
commit b9dd673518
5 changed files with 10 additions and 0 deletions

View File

@@ -13,8 +13,10 @@ COMMIT_URL = os.environ.get("COMMIT_URL")
COMMIT_MESSAGE = os.environ.get("COMMIT_MESSAGE")
RUN_URL = os.environ.get("RUN_URL")
TITLE = os.environ.get("TITLE")
VERSION = os.environ.get("VERSION")
MSG_TEMPLATE = """
*{title}*
_{version}_
```
{commit_message}
```
@@ -26,6 +28,7 @@ MSG_TEMPLATE = """
def get_caption():
msg = MSG_TEMPLATE.format(
title=helpers.escape_markdown(TITLE, 2),
version=helpers.escape_markdown(VERSION, 2),
commit_message=helpers.escape_markdown(COMMIT_MESSAGE, 2, telegram.MessageEntity.PRE),
commit_url=helpers.escape_markdown(COMMIT_URL, 2, telegram.MessageEntity.TEXT_LINK),
run_url=helpers.escape_markdown(RUN_URL, 2, telegram.MessageEntity.TEXT_LINK)
@@ -57,6 +60,9 @@ def check_environ():
if TITLE is None:
print("[-] Invalid TITLE")
exit(1)
if VERSION is None:
print("[-] Invalid VERSION")
exit(1)
async def main():