2023-11-10 00:13:24 +01:00
2023-12-30 01:19:24 +01:00
2023-12-30 01:19:24 +01:00
2023-12-30 01:19:42 +01:00
2023-12-30 01:19:24 +01:00
2023-12-30 01:19:24 +01:00
2023-12-30 01:19:42 +01:00
2020-07-04 17:49:39 +02:00
2023-12-30 01:19:24 +01:00

What for?

This project is a simple Python script to send a email when tracked Github projects (specified in conf) have a new release. The purpose is to use this script in a cron table.

Unbelievable, but I haven't found an existing equivalent!

An example of mail sent by the script

Why using configuration?...

...instead use stared project of your Github account? Cause I've got about 80 "stared" projects and I don't wan't to be alerted for new releases of each of these project.

And, Github API limits is at 60 requests by seconds, and I want to write this script really quickly in a first time.

But, perhaps I'll add such a feature later on...

How to use?

Really simple!

  • Install dependances: pip install -r requirements.txt
  • Edit conf.ini file to set [config] section:
    • your SMTP server configuration (host and port)
    • sender mail
    • receiver mail (⚠️ not tested with more than 1 receiver)
  • ...or use environment variable - same name but in upper case e.g. SMTP_PORT
  • Add projects you want to follow in the section [project]
    • Be careful to follow a JSON valid syntax as in the provided file, i.e. coma after each autor/project except the last one.

Execute the script: python notifier.py

After first execution, the conf.ini file will be filled with last release tag found by the script, as you can see in the provided file.

Hope you like, and have fun to read your mail!

Hey, what is this API?

Since it's not really conveniant to go on a VM and edit the config.ini every time I find a cool new project whose new versions I want to keep track of, there is an API to do this.

This is a really simple thing with no verification: you can add everything that you want!

Just one endpoint: subscription, and two method: GET and PUT. PUT take three parameters:

  • project: full project name e.g. MaxenceG2M/github-release-notifier or "short" name (without author) e.g. github-release-notifier
  • (optionnal) author: the author of the repository
  • (optionnal) credentials: just the TOTP check code.

Indeed, to have a minimal better-than-nothing protection, I opted for a simple TOTP code. No user/password or wathever. You can disable-it in the config.ini, or specify a custom key. If you don't specify a key, information will be displayed at startup (URL and the actual code. Be quick to check if it's ok!).

To start the API:

$ uvicorn notifier:app
TOTP enabled.
    Information: otpauth://totp/Secret?secret=mysuperkey
    TOTP check: 377826
INFO:     Started server process [28264]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)

Cron-it with ofelia

Ofelia is very conveniant for croning the verification part while letting the API run continuously. So the docker-compose.yml use it to do this :)

<3

Problems I have to solve really quickly

One script to do all things.

For who's asking: yes, it's normal that I have put all code in one main function one main script like a blind gunner.. I want to keep this script as simple as possible.

But overall, the script works and sends mail!

Hey boy, what is the pit.db file?

Oh, just for fun, and because I love this project, I use pit by michaeldv to follow my task etc.

It makes me think I should push my python version of this project on occasion when I will take the time to do...

Description
Send mail notification on new released versions of Github projects
Readme 102 KiB
Languages
Python 49.8%
HTML 27.6%
Just 20.5%
Dockerfile 2.1%