A Python-based service that monitors GitHub repositories for new commits and sends notifications to a Gotify server. This tool is designed to help you stay informed about updates to public repositories without requiring webhooks or authentication.
- Multiple Repository Tracking: Monitor any number of public GitHub repositories
- Real-time Notifications: Receive push notifications via Gotify when new commits are detected
- Dynamic Configuration: Add or remove tracked repositories without restarting the service
- GitHub Authentication: Optional Personal Access Token (PAT) support for higher API rate limits
- Docker Support: Run as a lightweight, containerized service
- Low Resource Usage: Efficient polling system with configurable intervals
- Persistent State: Maintains state across restarts to prevent duplicate notifications
- Docker and Docker Compose
- A running Gotify server with an application token
- Optional: GitHub Personal Access Token for higher rate limits
-
Clone this repository:
git clone https://github.com/jagrit007/gotify-github_repo_change_tracker.git cd gotify-github_repo_change_tracker -
Configure your repositories and Gotify settings in
config/config.json:{ "repositories": [ "microsoft/vscode", "tensorflow/tensorflow", "kubernetes/kubernetes" ], "gotify": { "url": "https://your-gotify-instance.com", "token": "your-gotify-token" }, "github": { "token": "your-github-personal-access-token" }, "check_interval": 300 } -
Build and start the service:
docker-compose up -d
-
Check the logs:
docker-compose logs -f
The config.json file supports the following options:
| Option | Description | Default |
|---|---|---|
repositories |
Array of repositories to monitor in owner/name format |
[] |
gotify.url |
URL of your Gotify server | Required |
gotify.token |
Application token from your Gotify server | Required |
github.token |
GitHub Personal Access Token for API authentication | Optional |
check_interval |
Time between checks in seconds | 300 (5 minutes) |
Using a GitHub Personal Access Token (PAT) is highly recommended as it increases your API rate limit from 60 requests per hour (unauthenticated) to 5,000 requests per hour (authenticated).
- Go to GitHub β Settings β Developer settings β Personal access tokens
- Click "Generate new token"
- Give it a descriptive name
- Select the
public_reposcope (orrepofor private repositories if needed) - Click "Generate token" and copy the token
- Add it to your
config.jsonfile
The service will automatically detect and use the token if provided, but will work without it with reduced rate limits.
- The service periodically checks the GitHub API for each configured repository
- When a new commit is detected, it sends a notification to your Gotify server
- The notification includes details about the commit (author, message, timestamp, URL)
- The service stores the last seen commit to avoid duplicate notifications
- Rate limits are monitored and logged to help avoid hitting GitHub API limits
github-repo-monitor/
βββ config/ # Configuration files
β βββ config.json # Main configuration
βββ data/ # Persistent state storage
βββ github_monitor.py # Main Python script
βββ Dockerfile # Docker image definition
βββ docker-compose.yml # Docker Compose configuration
βββ requirements.txt # Python dependencies
If you prefer not to use Docker:
- Install Python 3.9 or higher
- Install dependencies:
pip install -r requirements.txt - Create the data directory:
mkdir -p data - Configure
config.json - Run the script:
python github_monitor.py
The default check interval is 5 minutes (300 seconds). You can change this by updating the check_interval value in your config.json.
With GitHub authentication, you can safely reduce this interval to check more frequently. Without authentication, be careful not to set it too low to avoid hitting rate limits.
- Without Authentication: Limited to 60 requests per hour
- With Authentication: Up to 5,000 requests per hour
The script logs remaining rate limits with each API call, helping you monitor usage and adjust your check interval accordingly.
To update to a newer version:
git pull
docker-compose down
docker-compose build --no-cache
docker-compose up -d- Verify your Gotify URL and token are correct
- Check if the repository has had new commits since starting the service
- Examine the logs:
docker-compose logs -f
If you see errors related to rate limiting:
- Add a GitHub Personal Access Token to your configuration
- Increase the check interval
- Reduce the number of repositories being monitored
If the service is using too many resources:
- Increase the
check_intervalin the configuration - Reduce the number of repositories being monitored
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- GitHub API
- Gotify
- All the awesome open source projects we're helping you monitor!