Add Telegram notification

This commit is contained in:
Pig Fang 2019-12-07 15:59:00 +08:00
parent 7e8929d34f
commit 61eea2b980
2 changed files with 26 additions and 0 deletions

20
.github/workflows/Telegram.yml vendored Normal file
View File

@ -0,0 +1,20 @@
name: Telegram
on:
push:
branches:
- dev
jobs:
notification:
name: Send Message
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Run bot
run: ./scripts/bot.ps1
shell: pwsh
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}

6
scripts/bot.ps1 Normal file
View File

@ -0,0 +1,6 @@
$botRelease = (Invoke-WebRequest 'https://api.github.com/repos/bs-community/telegram-bot/releases/latest').Content | ConvertFrom-Json
$botBinUrl = ((Invoke-WebRequest $botRelease.assets_url).Content | ConvertFrom-Json).browser_download_url
bash -c "curl -fSL $botBinUrl -o bot"
chmod +x ./bot
./bot diff