From b207242c2ec8671a3970ad5c621df64b7eff6119 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 30 Aug 2023 15:38:18 +0700 Subject: [PATCH] update workflow --- .github/workflows/debug.yml | 5 +++-- docs/tubot.py | 15 ++++++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml index 05c345b..dbfa3b9 100644 --- a/.github/workflows/debug.yml +++ b/.github/workflows/debug.yml @@ -80,9 +80,10 @@ jobs: COMMIT_MESSAGE: ${{ github.event.head_commit.message }} COMMIT_URL: ${{ github.event.head_commit.url }} RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - TITLE: B4R ${{ steps.get_tags.outputs.tag }}_${{ steps.get_tags.outputs.version }}_debug + TITLE: box for root ${{ steps.get_tags.outputs.tag }}_${{ steps.get_tags.outputs.version }}_debug run: | - export VERSION=$(git rev-parse --short HEAD) + export VERSION=$(git describe --tags) + export CG=$(git log --oneline -n 5) FILE=$(find ./bfr/* -type f) pip3 install python-telegram-bot python3 docs/tubot.py $FILE \ No newline at end of file diff --git a/docs/tubot.py b/docs/tubot.py index cb6e3aa..f80b975 100644 --- a/docs/tubot.py +++ b/docs/tubot.py @@ -14,12 +14,17 @@ COMMIT_MESSAGE = os.environ.get("COMMIT_MESSAGE") RUN_URL = os.environ.get("RUN_URL") TITLE = os.environ.get("TITLE") VERSION = os.environ.get("VERSION") +CG = os.environ.get("CG") MSG_TEMPLATE = """ *{title}* + +{version} + +[Commit](https://github.com/shioeri/sing-box/commits/dev-next): ``` -{commit_message} +{cg} ``` -[commit]({commit_url}) + """.strip() @@ -27,6 +32,7 @@ def get_caption(): msg = MSG_TEMPLATE.format( title=helpers.escape_markdown(TITLE, 2), version=helpers.escape_markdown(VERSION, 2), + cg=helpers.escape_markdown(CG, 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) @@ -61,10 +67,13 @@ def check_environ(): if VERSION is None: print("[-] Invalid VERSION") exit(1) + if CG is None: + print("[-] Invalid CG") + exit(1) async def main(): - print("[+] Uploading to telegram") + print("[+] Uploading To Telegram") check_environ() print("[+] Files:", sys.argv[1:]) bot = telegram.Bot(BOT_TOKEN)