Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hifly81/github-utils
Utility wrapper for github rest APIs
https://github.com/hifly81/github-utils
crontab github github-api statistics telegram-bot telegram-bot-api
Last synced: 19 days ago
JSON representation
Utility wrapper for github rest APIs
- Host: GitHub
- URL: https://github.com/hifly81/github-utils
- Owner: hifly81
- Created: 2024-01-25T11:39:43.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-02-29T08:53:17.000Z (10 months ago)
- Last Synced: 2024-11-02T18:42:15.948Z (2 months ago)
- Topics: crontab, github, github-api, statistics, telegram-bot, telegram-bot-api
- Language: Shell
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Github utils
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## How to use
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 statsexample _config_ file:
```bash
github_access_token="XXXXXXXX"
github_owner="hifly81"
github_repo="kafka-examples,saga-pattern-demo"
```### Page views
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:
```bash
$ page_views_last14days.sh
```Weekly basis:
```bash
$ page_views_last14days_perweek.sh
```### Top referral sources
Get the top 10 referrers over the last 14 days.
```bash
$ top10_path_last14days.sh
```### Top referral paths
Get the top 10 popular contents over the last 14 days.
```bash
$ top10_referrers_last14days.sh
```### Delete Workflow Run
Utility to run a mass deletion of GitHub Actions workflow runs
```bash
$ delete_all_workflows_run.sh
```## Telegram notifications
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```bash
$ telegram_notifications.sh
```## Crontab
This example with _crontab_ will schedule the creation of a report with last 14 days pageviews every day at 2:30pm
```bash
30 14 * * * ${SCRIPT_FOLDER}/page_views_last14days.sh >> ${OUTPUT_FOLDER}/"pageviews14days_$(date +\%Y-\%m-\%d).log"
```