Skip to content

Actions.

Actions. #8

name: Telegram Notifications
on:
push:
branches:
- main
jobs:
send-telegram-notification:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install Dependencies
run: pip install python-telegram-bot
- name: Send Telegram Notification
run: |
python -c "import asyncio;from telegram import Bot;async def send_message(): bot = Bot(token='${{ secrets.TELEGRAM_BOT_TOKEN }}'); chat_id = '${{ secrets.TELEGRAM_CHANNEL_ID }}'; commit_link = '${{ github.event.head_commit.url }}'; await bot.send_message(chat_id=chat_id, text=f'New commit! {commit_link}');asyncio.run(send_message())"