Skip to content

A Telegram bot that notifies you of new GitHub releases

License

Notifications You must be signed in to change notification settings

JanisV/release-bot

Repository files navigation

Telegram Chat Python 3.12 GitHub license Latest build Maintainability

release-bot - a Telegram bot that notifies you of new GitHub releases

This is a Telegram bot that monitors the releases of given repos, sending messages upon a new release.

If you don't need a local installation you can use public bot, avalaible at https://t.me/janisreleasebot.

Screenshot

Alternatives

This bot is inspired by new(releases), Github releases notify bot and release-bot.

Other similar tools:

  • Dockcheck - CLI tool to automate docker image updates;
  • Renovate - Automated dependency updates

Features

  • Easy subscription to repo by owner/name, GitHub/PyPI/npm URL or uploading requirements.txt or package.json file
  • Rich markdown formatting for release note
  • Auto subscription to starred repos
  • Ready for self-hosting, has docker image
  • Work locally, without white IP and domain name
  • Only Telegram token required

Commands

/start - show welcome message
/about - information about this bot
/help - brief usage info
/list - show your subscriptions
/editlist - show and edit your subscriptions
/starred username - subscribe to user's starred repos
/starred - unsubscribe from user's starred repos
/settings - change output format
/stats - basic server statistics

Stack

  • Python 3.12
  • Flask
  • telegramify_markdown
  • python-telegram-bot
  • PyGithub
  • APScheduler via Flask-APScheduler
  • SQLAlchemy via Flask-SQLAlchemy
  • Alembic via Flask-Migrate - SQLAlchemy database migrations

Running it yourself

With docker

Using docker compose:

services:
  release-bot:
    container_name: release-bot
    image: ghcr.io/janisv/release-bot:latest
    restart: unless-stopped
    environment:
      - TELEGRAM_BOT_TOKEN=<telegram_token>
      #- GITHUB_TOKEN=<github_token> # optional
      #- SITE_URL=https://<your_domain_name> # optional
    ports:
      - 5000:5000
    volumes:
      - /path/to/data:/app/data

or docker run:

docker run -p 5000:5000 -e TELEGRAM_BOT_TOKEN="<telegram_token>" -v /path/to/data:/app/data -d --name release-bot ghcr.io/janisv/release-bot:latest

From source

Look at Development section

Set the necessary env vars

TELEGRAM_BOT_TOKEN - get this from BotFather. You'll need to create a bot.

GITHUB_TOKEN - (optional) GitHub personal access token (classic) or fine-grained personal access token. When not specified working well for about 20 repos. More info at Rate limits for the REST API.

SITE_URL - (optional) URL used for listening for incoming requests from the Telegram servers. When not specified uses polling instead webhooks. More info at Marvin's Marvellous Guide to All Things Webhook.

CHAT_ID - (optional) Only messages from the specified chat ID are accepted. Can be a comma separated list. You can get your chat ID with @getmyid_bot. If not specified, all messages are accepted.

DATABASE_URI - (optional) When not specified local SQLite uses.

MAX_REPOS_PER_CHAT - (optional) Limit number of repos per user. Default 0 - unlimited.

LOG_LEVEL - (optional) Default INFO.

Development

Setup env vars and run:

pip3 install -r requirements.txt
flask db upgrade
python3 -m flask run -h 0.0.0.0

For use webhooks locally, you may want to use localhost.run.