https://github.com/scotchoaf/pull-github-metrics
uses the github API and auth token to pull data and format for bulk load into Elasticsearch
https://github.com/scotchoaf/pull-github-metrics
Last synced: 3 months ago
JSON representation
uses the github API and auth token to pull data and format for bulk load into Elasticsearch
- Host: GitHub
- URL: https://github.com/scotchoaf/pull-github-metrics
- Owner: scotchoaf
- License: mit
- Created: 2020-04-22T20:29:40.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T09:38:17.000Z (over 2 years ago)
- Last Synced: 2025-01-12T01:13:29.990Z (5 months ago)
- Language: Python
- Size: 22.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Git Metrics
Two modes:
* JSON output for bulk loading into Elasticsearch
* quick output to screen for single org/repo
### JSON output moderead a csv file with a list of github orgs and repos
output is repo traffic stats for views, clones, and top referrersUses a github personal auth token for authentication
python git_metrics_json_out.py -a {auth token} -f {repo list} -d {number of days to look back}
output of `daily-{run date}` and `referrer-{run date}` are formatted for bulk loading to elasticsearch using the commands:```bash
curl -s -XPOST 'http://localhost:9200/_bulk' --data-binary @daily.json -H "Content-Type: application/x-ndjson"
curl -s -XPOST 'http://localhost:9200/_bulk' --data-binary @referrer.json -H "Content-Type: application/x-ndjson"```
Use XDELETE in the event you need to delete a specific index in Elasticsearch
```bash
curl -XDELETE http://localhost:9200/daily
curl -XDELETE http://localhost:9200/referrer
```### Quick output mode
use input values for a quick view and to test access to a org and repo.
python git_metrics_quick.py -a {auth token} -o {org name} -r {repo name}
> default org is PaloAltoNetworksOutput display will show view, clone, and referrer data
## Git metrics raw CURL commands
```bash
curl -i -H "Authorization: token {auth token}" https://api.github.com/repos/{org name}/{repo name}/traffic/views
curl -i -H "Authorization: token {auth token}" https://api.github.com/repos/{org name}/{repo name}/traffic/clones
curl -i -H "Authorization: token {auth token}" https://api.github.com/repos/{org name}/{repo name}/traffic/popular/referrers
```