Python 3.12 bot for GitHub Actions. It checks Normal Stock and Mirage Stock every five minutes and posts only a new stock state to Telegram. No VPS or always-on server is needed.
The project uses public JSON APIs only; it does not scrape web pages. The default primary and fallback endpoints are in src/bot.py. If a provider changes an address or response schema, set the optional URL secrets below instead of changing the workflow.
-
Create a new GitHub repository from the contents of this directory and push it.
-
In Settings → Secrets and variables → Actions, add these repository secrets:
Secret Value TELEGRAM_BOT_TOKENTelegram bot token TELEGRAM_CHAT_IDTarget chat ID TOPIC_IDForum topic ID; omit it to post to the main chat -
Optional public API overrides:
Secret Purpose STOCK_API_PRIMARY_URLPrimary JSON API URL STOCK_API_FALLBACK_URLFallback JSON API URL
The bot needs permission to post in the chat/topic. GitHub scheduled workflows are best-effort: GitHub can occasionally delay a cron start, but the workflow schedule is configured as */5 * * * *.
The last successfully prepared stock is stored in GitHub Actions Cache, not committed to the repository. The cache is written before Telegram delivery, which ensures that an interrupted workflow will not publish the same stock twice. A failed Telegram request can therefore skip that particular update rather than risk a duplicate notification.
No third-party Python packages are required.
python -m unittest discover -s tests -vTo call the bot locally, set TELEGRAM_BOT_TOKEN, TELEGRAM_CHAT_ID, and optionally TOPIC_ID, then run python src/bot.py --prepare followed by python src/bot.py --send.