diff --git a/.github/workflows/Telegram.yml b/.github/workflows/Telegram.yml new file mode 100644 index 00000000..dfa347a1 --- /dev/null +++ b/.github/workflows/Telegram.yml @@ -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 }} diff --git a/scripts/bot.ps1 b/scripts/bot.ps1 new file mode 100644 index 00000000..6cce0258 --- /dev/null +++ b/scripts/bot.ps1 @@ -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