Skip to content

Latest commit

 

History

History
99 lines (67 loc) · 3.74 KB

README.md

File metadata and controls

99 lines (67 loc) · 3.74 KB

UpdateNotifier

Docker Image Docker Image Version

UpdateNotifier is a Python application that checks for the latest releases of specified GitHub repositories and sends notifications to a Discord channel if new updates are found.

Features

  • Fetches the latest release versions of specified GitHub repositories.
  • Sends notifications to a Discord channel using a webhook.
  • Allows ping settings for notification on Discord.
  • Logs activities and errors for easy debugging.

Requirements

  • Python 3.11 or higher
  • aiohttp
  • asyncio
  • discord-webhook
  • python-dotenv

You better have a virtual environment for your python installation. See here in order to setup it.

You can need a GitHub Personal Token in order to increase the rate limit for your requests.
Note that the rate without is 60 requests by hour, so if you have more services than this amount, you won't get all the version checks.
For that, go to your token settings (link) and create a token without any permissions. You can change the expiration date if needed.

Installation

  1. Clone the repository:

    git clone https://github.com/gylfirst/UpdateNotifier.git
    cd UpdateNotifier
  2. Install the required packages:

    pip install -r requirements.txt
  3. Rename the .env.example file in the root directory to .env and add your Discord webhook URL and role ID:

    DISCORD_WEBHOOK_URL = "your discord webhook url"
    DISCORD_ROLE_ID = "discord id (int)"
    LOG_LEVEL = "INFO"  # Optional, default is INFO
    GITHUB_TOKEN = "your github token"  # Optional, but you will have a rate limit of 60 requests per hour
    ALLOW_PING = True # Optional, default if True
    ALLOW_ALL_RELEASES_PING = False # Optional, default is False 

    You can change the log level if needed.

Usage

Python

  1. Add the GitHub repositories you want to monitor to the data/services.txt file. Each line should contain a repository in the format owner/repo.

  2. Run the application:

    python -m UpdateNotifier

Docker

You can use the docker image with the docker compose file.
The app is designed to be launched once, so you can set up a cronjob or a script to execute it regularly.

Configuration

  • Environment Variables:

    • DISCORD_WEBHOOK_URL: The URL of the Discord webhook.
    • DISCORD_ROLE_ID: The ID of the Discord role to ping.
    • LOG_LEVEL: The logging level (optional, default is INFO).
    • GITHUB_TOKEN: Your personal token to authenticate your requests.
    • ALLOW_PING: Allow the app to ping a role for the notification (default is True).
    • ALLOW_ALL_RELEASES_PING: Allow the app to ping for all releases, or just major ones (and strange versioning process)
  • Files:

    • data/services.txt: List of GitHub repositories to monitor.
    • data/versions.json: Stores the latest known versions of the repositories.
    • logs/app.log: Log file for the application.

Logging

The application uses a rotating file handler to manage logs. Logs are stored in logs/app.log with a maximum size of 5 MB per file and up to 3 backup files.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Author

Gylfirst