Building Real-time Web Page Ranking Monitoring with GitHub Action
·
2 min read
Recently, I had a requirement to monitor the ranking situation of a certain entry in a competition. Unfortunately, the event itself doesn’t have a ranking page, and the event data is paginated and unordered. Therefore, I thought of using GitHub Action to build a real-time web page ranking monitoring tool.
Implementation Approach
- Set up a GitHub Action schedule cron job, for example, execute every 10 minutes.
- Execute a script to request the web page’s API interface and get data information. Since I’m more familiar with JS, I use Node.js for implementation.
- Based on the data information, calculate ranking situations and process into needed data.
- Update to HTML based on the data.
- SSH connect to the server and upload HTML files.
- Meanwhile, send data to Telegram for instant IM notifications.
Final Deliverables
- HTML page displaying ranking information, refreshed every 10 minutes
- Telegram bot sending ranking information
GitHub Action Usage Notes
- GitHub Action’s cron expressions currently
do not support timezone settings
- For individual accounts/organizations, non-public repositories have execution quotas - currently 2000 minutes. If exceeded, usage will be suspended
Quota details: https://github.com/settings/billing/summary
- GitHub Action execution environments include macOS, which can be configured if needed
Final Thoughts
Building this entire system including development took just about an hour. I have to say GitHub Action is truly powerful, and you can create many creative solutions with it. The scheduled jobs and web scraping mentioned above are just the tip of the iceberg - there’s much more to explore in the future.