Github API Reference:
- https://docs.github.com/en/rest
- https://docs.github.com/en/rest/metrics/traffic
- https://docs.github.com/en/rest/actions/workflow-runs
Populate config file with:
- github_access_token: personal access token: To create one follow instructions at: https://github.com/settings/personal-access-tokens
- github_owner: github handle where the repository exists
- github_repo: github repositories (separated by ,) to fetch stats
example config file:
github_access_token="XXXXXXXX"
github_owner="hifly81"
github_repo="kafka-examples,saga-pattern-demo"
Get the total number of views and breakdown per day or week for the last 14 days. Timestamps are aligned to UTC midnight of the beginning of the day or week. Week begins on Monday.
Daily basis:
$ page_views_last14days.sh
Weekly basis:
$ page_views_last14days_perweek.sh
Get the top 10 referrers over the last 14 days.
$ top10_path_last14days.sh
Get the top 10 popular contents over the last 14 days.
$ top10_referrers_last14days.sh
Utility to run a mass deletion of GitHub Actions workflow runs
$ delete_all_workflows_run.sh
Script telegram_notifications.sh will send a report with page views and top referral to your Telegram Bot Channel.
Populate telegram_notifications.sh file with:
- BOT_TOKEN: Telegram Bot Token
- CHAT_ID: Telegram Bot Chat ID
$ telegram_notifications.sh
This example with crontab will schedule the creation of a report with last 14 days pageviews every day at 2:30pm
30 14 * * * ${SCRIPT_FOLDER}/page_views_last14days.sh >> ${OUTPUT_FOLDER}/"pageviews14days_$(date +\%Y-\%m-\%d).log"