ci: update message hint (#44)
This commit is contained in:
10
.github/workflows/build-kernel-5.10.yml
vendored
10
.github/workflows/build-kernel-5.10.yml
vendored
@@ -110,13 +110,15 @@ jobs:
|
|||||||
MESSAGE_THREAD_ID: ${{ secrets.MESSAGE_THREAD_ID }}
|
MESSAGE_THREAD_ID: ${{ secrets.MESSAGE_THREAD_ID }}
|
||||||
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
||||||
COMMIT_URL: ${{ github.event.head_commit.url }}
|
COMMIT_URL: ${{ github.event.head_commit.url }}
|
||||||
|
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||||
|
TITLE: kernel-aarch64-${{ matrix.version }}
|
||||||
run: |
|
run: |
|
||||||
if [ ! -z "${{ secrets.BOT_TOKEN }}" ]; then
|
if [ ! -z "${{ secrets.BOT_TOKEN }}" ]; then
|
||||||
OUTDIR=android-kernel/out/android12-5.10/dist
|
OUTDIR=android-kernel/out/android12-5.10/dist
|
||||||
IMAGE_GZ=kernel-aarch64-${{ matrix.version }}-Image.gz
|
IMAGE_GZ=${{ matrix.version }}-Image.gz
|
||||||
BOOT=kernel-aarch64-${{ matrix.version }}-boot.img.zip
|
BOOT=${{ matrix.version }}-boot.img.zip
|
||||||
BOOT_LZ4=kernel-aarch64-${{ matrix.version }}-boot-lz4.img.zip
|
BOOT_LZ4=${{ matrix.version }}-boot-lz4.img.zip
|
||||||
BOOT_GZ=kernel-aarch64-${{ matrix.version }}-boot-gz.img.zip
|
BOOT_GZ=${{ matrix.version }}-boot-gz.img.zip
|
||||||
mv $OUTDIR/Image.gz $IMAGE_GZ
|
mv $OUTDIR/Image.gz $IMAGE_GZ
|
||||||
zip $BOOT -j -r $OUTDIR/boot.img
|
zip $BOOT -j -r $OUTDIR/boot.img
|
||||||
zip $BOOT_LZ4 -j -r $OUTDIR/boot-gz.img
|
zip $BOOT_LZ4 -j -r $OUTDIR/boot-gz.img
|
||||||
|
|||||||
4
.github/workflows/build-kernel-5.15.yml
vendored
4
.github/workflows/build-kernel-5.15.yml
vendored
@@ -64,10 +64,12 @@ jobs:
|
|||||||
MESSAGE_THREAD_ID: ${{ secrets.MESSAGE_THREAD_ID }}
|
MESSAGE_THREAD_ID: ${{ secrets.MESSAGE_THREAD_ID }}
|
||||||
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
||||||
COMMIT_URL: ${{ github.event.head_commit.url }}
|
COMMIT_URL: ${{ github.event.head_commit.url }}
|
||||||
|
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||||
|
TITLE: kernel-aarch64-${{ matrix.version }}
|
||||||
run: |
|
run: |
|
||||||
if [ ! -z "${{ secrets.BOT_TOKEN }}" ]; then
|
if [ ! -z "${{ secrets.BOT_TOKEN }}" ]; then
|
||||||
OUTDIR=android-kernel/out/android13-5.15/dist
|
OUTDIR=android-kernel/out/android13-5.15/dist
|
||||||
BOOT=kernel-aarch64-${{ matrix.version }}-boot.img.zip
|
BOOT=${{ matrix.version }}-boot.img.zip
|
||||||
zip $BOOT -j -r $OUTDIR/boot.img
|
zip $BOOT -j -r $OUTDIR/boot.img
|
||||||
pip3 install python-telegram-bot
|
pip3 install python-telegram-bot
|
||||||
python3 $GITHUB_WORKSPACE/KernelSU/scripts/ksubot.py $BOOT
|
python3 $GITHUB_WORKSPACE/KernelSU/scripts/ksubot.py $BOOT
|
||||||
|
|||||||
3
.github/workflows/build-su.yml
vendored
3
.github/workflows/build-su.yml
vendored
@@ -5,6 +5,7 @@ on:
|
|||||||
paths:
|
paths:
|
||||||
- '.github/workflows/build-su.yml'
|
- '.github/workflows/build-su.yml'
|
||||||
- 'userspace/**'
|
- 'userspace/**'
|
||||||
|
- 'scripts/ksubot.py'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ "main" ]
|
branches: [ "main" ]
|
||||||
paths:
|
paths:
|
||||||
@@ -35,6 +36,8 @@ jobs:
|
|||||||
MESSAGE_THREAD_ID: ${{ secrets.MESSAGE_THREAD_ID }}
|
MESSAGE_THREAD_ID: ${{ secrets.MESSAGE_THREAD_ID }}
|
||||||
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
||||||
COMMIT_URL: ${{ github.event.head_commit.url }}
|
COMMIT_URL: ${{ github.event.head_commit.url }}
|
||||||
|
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||||
|
TITLE: SU
|
||||||
run: |
|
run: |
|
||||||
if [ ! -z "${{ secrets.BOT_TOKEN }}" ]; then
|
if [ ! -z "${{ secrets.BOT_TOKEN }}" ]; then
|
||||||
pip3 install python-telegram-bot
|
pip3 install python-telegram-bot
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import asyncio
|
import asyncio
|
||||||
import telegram
|
import telegram
|
||||||
|
from telegram import helpers
|
||||||
|
|
||||||
|
|
||||||
BOT_TOKEN = os.environ.get("BOT_TOKEN")
|
BOT_TOKEN = os.environ.get("BOT_TOKEN")
|
||||||
@@ -10,10 +11,25 @@ CACHE_CHAT_ID = os.environ.get("CACHE_CHAT_ID")
|
|||||||
MESSAGE_THREAD_ID = os.environ.get("MESSAGE_THREAD_ID")
|
MESSAGE_THREAD_ID = os.environ.get("MESSAGE_THREAD_ID")
|
||||||
COMMIT_URL = os.environ.get("COMMIT_URL")
|
COMMIT_URL = os.environ.get("COMMIT_URL")
|
||||||
COMMIT_MESSAGE = os.environ.get("COMMIT_MESSAGE")
|
COMMIT_MESSAGE = os.environ.get("COMMIT_MESSAGE")
|
||||||
|
RUN_URL = os.environ.get("RUN_URL")
|
||||||
|
TITLE = os.environ.get("TITLE")
|
||||||
|
MSG_TEMPLATE = """
|
||||||
|
*{title}*
|
||||||
|
```
|
||||||
|
{commit_message}
|
||||||
|
```
|
||||||
|
[Commit]({commit_url})
|
||||||
|
[Workflow run]({run_url})
|
||||||
|
""".strip()
|
||||||
|
|
||||||
|
|
||||||
def get_caption():
|
def get_caption():
|
||||||
msg = COMMIT_MESSAGE + "\n" + COMMIT_URL
|
msg = MSG_TEMPLATE.format(
|
||||||
|
title=helpers.escape_markdown(TITLE, 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)
|
||||||
|
)
|
||||||
if len(msg) > telegram.constants.MessageLimit.CAPTION_LENGTH:
|
if len(msg) > telegram.constants.MessageLimit.CAPTION_LENGTH:
|
||||||
return COMMIT_URL
|
return COMMIT_URL
|
||||||
return msg
|
return msg
|
||||||
@@ -35,6 +51,12 @@ def check_environ():
|
|||||||
if COMMIT_MESSAGE is None:
|
if COMMIT_MESSAGE is None:
|
||||||
print("[-] Invalid COMMIT_MESSAGE")
|
print("[-] Invalid COMMIT_MESSAGE")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
if RUN_URL is None:
|
||||||
|
print("[-] Invalid RUN_URL")
|
||||||
|
exit(1)
|
||||||
|
if TITLE is None:
|
||||||
|
print("[-] Invalid TITLE")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
|
||||||
async def main():
|
async def main():
|
||||||
@@ -56,7 +78,9 @@ async def main():
|
|||||||
print("[+] Upload: " + one)
|
print("[+] Upload: " + one)
|
||||||
msg = await bot.send_document(CACHE_CHAT_ID, one)
|
msg = await bot.send_document(CACHE_CHAT_ID, one)
|
||||||
if one == paths[-1]:
|
if one == paths[-1]:
|
||||||
files.append(telegram.InputMediaDocument(msg.document, caption=caption))
|
files.append(telegram.InputMediaDocument(msg.document,
|
||||||
|
caption=caption,
|
||||||
|
parse_mode=telegram.constants.ParseMode.MARKDOWN_V2))
|
||||||
else:
|
else:
|
||||||
files.append(telegram.InputMediaDocument(msg.document))
|
files.append(telegram.InputMediaDocument(msg.document))
|
||||||
await bot.delete_message(CACHE_CHAT_ID, msg.message_id)
|
await bot.delete_message(CACHE_CHAT_ID, msg.message_id)
|
||||||
|
|||||||
Reference in New Issue
Block a user