mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-22 12:55:38 +00:00
👷 Beta 插件更新通知
This commit is contained in:
parent
156d20864c
commit
57944ec2e5
35
.github/workflows/python beta.yml
vendored
Normal file
35
.github/workflows/python beta.yml
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
name: Github commit to telegram
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- beta
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# 此步骤使用 GitHub 的 https://github.com/actions/checkout
|
||||
- name: checkout actions
|
||||
uses: actions/checkout@v1
|
||||
|
||||
# 设置python环境
|
||||
# 此步骤使用 GitHub 的 https://github.com/actions/setup-python
|
||||
- name: Set up Python 3.7
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: 3.7
|
||||
|
||||
# 安装依赖
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
mkdir tmp && cd tmp
|
||||
python -m pip install --upgrade pip
|
||||
pip install requests
|
||||
|
||||
# 发送通知
|
||||
- name: Send notice
|
||||
run: |
|
||||
cd tmp
|
||||
cp ../telegram_update_beta.py ./
|
||||
python telegram_update_beta.py ${{ secrets.TG_BOT_TOKEN }}
|
25
telegram_update_beta.py
Normal file
25
telegram_update_beta.py
Normal file
@ -0,0 +1,25 @@
|
||||
import json, time, sys
|
||||
from requests import get, post
|
||||
|
||||
token = str(sys.argv[1])
|
||||
main = json.loads(get("https://api.github.com/repos/xtaodada/PagerMaid_Plugins/commits/beta").content)
|
||||
push_content = {}
|
||||
push_content['chat_id'] = '-1001441461877'
|
||||
push_content['disable_web_page_preview'] = 'True'
|
||||
push_content['parse_mode'] = 'markdown'
|
||||
push_content['text'] = "#更新日志 #beta #" + main['commit']['author'][
|
||||
'name'].replace('_', '') + ' \n\n🔨 [' + main['sha'][0:7] + '](https://github.com/xtaodada/PagerMaid_Plugins/compare/' + \
|
||||
main[
|
||||
'sha'] + '): ' + main['commit']['message']
|
||||
url = 'https://api.telegram.org/bot' + token + '/sendMessage'
|
||||
try:
|
||||
main_req = post(url, data=push_content)
|
||||
except:
|
||||
pass
|
||||
push_content['chat_id'] = '-1001319957857'
|
||||
time.sleep(1)
|
||||
try:
|
||||
main_req = get(url, data=push_content)
|
||||
except:
|
||||
pass
|
||||
print(main['sha'] + " ok!")
|
Loading…
Reference in New Issue
Block a user