diff --git a/.github/workflows/build-manager.yml b/.github/workflows/build-manager.yml index 054edc87..90f0f3e6 100644 --- a/.github/workflows/build-manager.yml +++ b/.github/workflows/build-manager.yml @@ -196,6 +196,7 @@ jobs: COMMIT_URL: ${{ github.event.head_commit.url }} RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} TITLE: Manager + BRANCH: ${{ github.ref_name }} run: | if [ ! -z "${{ secrets.BOT_TOKEN }}" ]; then export VERSION=$(git rev-list --count HEAD) diff --git a/scripts/ksubot.py b/scripts/ksubot.py index 3d254488..d87b0162 100644 --- a/scripts/ksubot.py +++ b/scripts/ksubot.py @@ -2,6 +2,7 @@ import asyncio import os import sys from telethon import TelegramClient +from telethon.tl.functions.help import GetConfigRequest API_ID = 611335 API_HASH = "d524b414d21f4d37f08684c1df41ac9c" @@ -15,8 +16,10 @@ COMMIT_MESSAGE = os.environ.get("COMMIT_MESSAGE") RUN_URL = os.environ.get("RUN_URL") TITLE = os.environ.get("TITLE") VERSION = os.environ.get("VERSION") +BRANCH = os.environ.get("BRANCH") MSG_TEMPLATE = """ **{title}** +Branch: {branch} #ci_{version} ``` {commit_message} @@ -29,6 +32,7 @@ MSG_TEMPLATE = """ def get_caption(): msg = MSG_TEMPLATE.format( title=TITLE, + branch=BRANCH, version=VERSION, commit_message=COMMIT_MESSAGE, commit_url=COMMIT_URL, @@ -48,10 +52,7 @@ def check_environ(): print("[-] Invalid CHAT_ID") exit(1) else: - try: - CHAT_ID = int(CHAT_ID) - except: - pass + CHAT_ID = int(CHAT_ID) if COMMIT_URL is None: print("[-] Invalid COMMIT_URL") exit(1) @@ -67,14 +68,14 @@ def check_environ(): if VERSION is None: print("[-] Invalid VERSION") exit(1) - if MESSAGE_THREAD_ID is not None and MESSAGE_THREAD_ID != "": - try: - MESSAGE_THREAD_ID = int(MESSAGE_THREAD_ID) - except: - print("[-] Invaild MESSAGE_THREAD_ID") - exit(1) + if BRANCH is None: + print("[-] Invalid BRANCH") + exit(1) + if MESSAGE_THREAD_ID is None: + print("[-] Invaild MESSAGE_THREAD_ID") + exit(1) else: - MESSAGE_THREAD_ID = None + MESSAGE_THREAD_ID = int(MESSAGE_THREAD_ID) async def main(): @@ -103,4 +104,4 @@ if __name__ == "__main__": try: asyncio.run(main()) except Exception as e: - print(f"[-] An error occurred: {e}") + print(f"[-] An error occurred: {e}") \ No newline at end of file