Documentation Index
Fetch the complete documentation index at: https://mintlify.com/521xueweihan/HelloGitHub/llms.txt
Use this file to discover all available pages before exploring further.
github_bot.py is a Python script that automates the discovery of interesting GitHub projects. It monitors which repositories the accounts followed on GitHub have recently starred, filters out low-signal results by enforcing a minimum star threshold (default: 100 stars), sorts the remaining candidates by total star count, and sends a formatted HTML email digest to configured recipients for editorial review.
Installation
Install dependencies
The script depends on the
requests library. Install it from the provided requirements file:requirements.txt contains:Configure credentials
Open Save the file once all values are filled in.
script/github_bot/github_bot.py and fill in the three configuration blocks near the top of the file:Configuration
The script is configured entirely through three top-level variables ingithub_bot.py.
ACCOUNT
Controls which GitHub account is used to call the API and whose followed-user network is monitored.
| Field | Description |
|---|---|
username | GitHub username for API authentication and event feed access |
password | GitHub password or Personal Access Token (PAT) — see warning below |
MAIL
Controls the outgoing email connection via SMTP.
| Field | Default | Description |
|---|---|---|
mail | — | Sender email address shown in the From field |
username | — | SMTP login username (often identical to mail) |
password | — | SMTP account password or app-specific password |
host | smtp.qq.com | SMTP server hostname |
port | 465 | SMTP server port (SSL) |
RECEIVERS
A Python list of recipient email address strings. All addresses in the list receive every digest email:
Optional tuning constants
Two additional constants control filtering behaviour:| Constant | Default | Description |
|---|---|---|
DAY | 1 | How many days back to look for star events |
STARS | 100 | Minimum star count for a repository to appear in the digest |
How It Works
The script follows a linear pipeline each time it runs:- Authenticates with GitHub API — uses the
ACCOUNTcredentials to make authenticated requests, which provides a higher rate limit than anonymous calls. - Fetches recent star events from followed accounts — calls the GitHub Events API (
/users/{username}/received_events) across up to 10 pages of 30 events each, collecting a maximum of 300 events total. - Filters out self-starred repositories — any
WatchEventwhere the repository name contains the authenticated username’s own account is excluded, keeping the digest focused on external discoveries. - Applies time and star-count filters — only events within the configured
DAYwindow are kept, and only repositories with at leastSTARSstars (default: 100) pass through. Repositories whose star count cannot be fetched (network timeout) are retained with a sentinel value of-1so they are not silently dropped. - Sorts results by star count (descending) — the surviving repositories are ordered from most-starred to least-starred, so editors see the highest-signal projects first.
- Formats a digest email — project data (avatar, username, repository name, star date, star count) is rendered into an HTML table using
CONTENT_FORMAT. - Sends via SMTP to configured recipients — connects to the SMTP host over SSL (
SMTP_SSL), authenticates, and delivers the message to every address inRECEIVERS.
Limitations
- 300-event cap — The GitHub Events API returns at most 300 events (10 pages × 30 per page). High-volume networks may miss older events.
- API rate limiting — Unauthenticated requests are capped at 60 per hour. Authenticated requests raise this to 5,000 per hour, so valid credentials are effectively required.
- Password-based auth is deprecated — GitHub removed password authentication for API calls. A Personal Access Token must be used in the
passwordfield. - Sequential star-count lookups — Individual repository star counts are fetched one at a time with a 2-second timeout each. Large event lists will slow execution noticeably; failed lookups fall back to
-1.
This script is designed for internal HelloGitHub editorial use. The registered GitHub account
521hellogithub is used to collect daily trending data.