修复 Github Action

This commit is contained in:
xtaodada 2022-06-08 16:58:40 +08:00
parent c1655b32a6
commit 7833d7ba81
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
7 changed files with 162 additions and 0 deletions

23
.github/ISSUE_TEMPLATE/bug_report_en.md vendored Normal file
View File

@ -0,0 +1,23 @@
---
name: 🐛 Bug Report
about: Submit discovered bugs
---
<!--
Please ensure you have read [wiki](https://xtaolabs.com) and [issue](https://github.com/Xtao-Labs/PagerMaid-Modify/issues), and provide all the information required by this template.
Otherwise the issue will be closed immediately.Please do not repeat the issue.
-->
### BUG occurrence address
### What is expected?
### What is actually happening?
### Additional info (logs errors etc)
<!--
Please ensure you have deployed the [master branch](https://github.com/Xtao-Labs/PagerMaid-Modify/tree/master)
generated by github-issue-template.This issue is in English.
-->

23
.github/ISSUE_TEMPLATE/bug_report_zh.md vendored Normal file
View File

@ -0,0 +1,23 @@
---
name: 🐛 Bug 报告
about: 早起的虫子被你抓
---
<!--
请确保已阅读 [文档](https://xtaolabs.com) 和 [issue](https://github.com/Xtao-Labs/PagerMaid-Modify/issues) 内相关部分,并按照模版提供信息
否则 issue 将被立即关闭请勿重复提issue
-->
### BUG 发生地址
### 预期是什么?
### 实际发生了什么?
### 额外信息(日志、报错等)
<!--
请确保您部署的是[主线 master 分支](https://github.com/Xtao-Labs/PagerMaid-Modify/tree/master)的最新版
generated by github-issue-template
-->

View File

@ -0,0 +1,19 @@
---
name: 🍰 Feature Request
about: Submit a new feature request
---
<!--
Feature Request(https://xtaolabs.com) and [issue](https://github.com/Xtao-Labs/PagerMaid-Modify/issues) , and provide all the information required by this template.
Otherwise the issue will be closed immediately.
-->
### What feature is it?
### What can this function do?
### Additional description
<!--
generated by github-issue-template.This issue is in English.
-->

View File

@ -0,0 +1,19 @@
---
name: 🍰 功能需求
about: 提交新的功能需求
---
<!--
请确保 [文档](https://xtaolabs.com) 和 [issue](https://github.com/Xtao-Labs/PagerMaid-Modify/issues) 中没有相关内容,并按照模版提供信息
否则 issue 将被立即关闭
-->
### 这是一个什么样的功能?
### 这个 feature 可以干什么?
### 额外描述
<!--
generated by github-issue-template
-->

21
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,21 @@
## 该 PR 相关 Issue / Involved issue
Close #
## 插件名称 / Name
```
```
## 更改检查表 / Change Checklist
- [ ] 有插件版本号更新
- [ ] 有多语言支持
- [ ] CN
- [ ] EN
- [ ] 会触发频率限制 Will trigger a rate limit?
- [ ] 如果会, 是否有对应的措施? If yes, do your code reflect this sign?
- [ ] 添加了新的依赖包 New package added
## 说明 / Note

35
.github/workflows/python.yml vendored Normal file
View File

@ -0,0 +1,35 @@
name: Github commit to telegram
on:
push:
branches:
- v2
jobs:
build:
runs-on: ubuntu-latest
steps:
# 此步骤使用 GitHub 的 https://github.com/actions/checkout
- name: checkout actions
uses: actions/checkout@v3
# 设置python环境
# 此步骤使用 GitHub 的 https://github.com/actions/setup-python
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: 3.9
# 安装依赖
- name: Install dependencies
run: |
mkdir tmp && cd tmp
python -m pip install --upgrade pip
pip install httpx
# 发送通知
- name: Send notice
run: |
cd tmp
cp ../telegram_update.py ./
python telegram_update.py ${{ secrets.TG_BOT_TOKEN }}

22
telegram_update.py Normal file
View File

@ -0,0 +1,22 @@
import json, time, sys
from httpx import get, post
token = str(sys.argv[1])
main = json.loads(get("https://api.github.com/repos/TeamPGM/PagerMaid_Plugins_Pyro/commits/v2").content)
text = "#更新日志 #pyro #" + main['commit']['author']['name'].replace('_', '') + \
' \n\n🔨 [' + main['sha'][0:7] + '](https://github.com/TeamPGM/PagerMaid_Plugins_Pyro/commit/' + \
main['sha'] + '): ' + main['commit']['message']
push_content = {'chat_id': '-1001441461877', 'disable_web_page_preview': 'True', 'parse_mode': 'markdown',
'text': text}
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 = post(url, data=push_content)
except:
pass
print(main['sha'] + " ok")