Extract & Plot Git Repo Clones/Views Beyond 14-day Insights
Problem: GitHub Insights → Traffic data only offers 14 days of visit/clone data.
Solution: git_traffik automatically collects and stores your repository's traffic data every 10-14 days, building historical datasets beyond GitHub's limit.
Result: Continuous historical data in CSV format + automated visualizations for any repository.
Choose your preferred method:
| Method | Use Case |
|---|---|
| Standalone Repo | Track any repository |
| Within Your Repo | Track the same repository |
| Local Execution | Manual control & scheduling |
Best for: Tracking any repository from a dedicated monitoring repo.
- Get the code: Fork this repository or clone it locally
- Configure repository details in
.github/workflows/repo.yaml:
-
Create access token: Generate a personal access token with repository permissions
-
Add secret: Go to Settings → Secrets & Variables → Actions, create
REPO_A_ACCESS_TOKENwith your token -
Enable permissions: Settings → Actions → General → Workflow Permissions → "Read and write permissions"
- Manual trigger: Run anytime from Actions tab
- Automatic: Runs on 1st, 11th, and 21st of each month
- Customize schedule: Modify the cron schedule
Best for: Tracking the same repository where the code lives.
-
Copy files to your repository:
- Copy
git_traffik/folder to your repo root - Copy
.github/workflows/repo.yamlto.github/workflows/
- Copy
-
Simplify authentication - Update
repo.yaml:# Change this: MY_ACCESS_TOKEN: ${{ secrets.REPO_A_ACCESS_TOKEN }} # To this: MY_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
Enable permissions: Settings → Actions → General → Workflow Permissions → "Read and write permissions"
Benefit: No need to create personal access tokens! Uses GitHub's automatic authentication.
Best for: Manual control or custom scheduling on your machine.
-
Download script: Get
./git_traffik/repo_check_traffic.py -
Install dependencies:
pip install requests pandas matplotlib seaborn
-
Configure script: Update owner, repo, and token variables:
- Run manually or set up cron job using crontab
- CSV files: Complete historical traffic data
- 📊 PNG visualizations: Two-panel plots (views + clones over time)
- Regular updates: Scheduled collection every ~10 days
Results appear in ./git_traffik/output/:
{REPO_NAME}_git-trafficdata.csv{REPO_NAME}_traffic-data.png
The GitHub Actions workflow automatically:
- Fetches current 14-day traffic data via GitHub API
- Merges with existing historical data (if any)
- Cleans data: removes duplicates, filters zero-traffic days
- Generates updated CSV and visualization files
- Commits results back to repository
- Uploads artifacts for easy download
requests- GitHub API communicationpandas- Data manipulation and CSV handlingmatplotlib&seaborn- Traffic visualization
Default: '0 0 1,11,21 * *' (1st, 11th, 21st of each month at midnight UTC)
Customize in .github/workflows/repo.yaml using cron syntax.
I created this tool for my PyReliMRI package to:
- Track adoption: Monitor if people are actually using the package
- Inform decisions: Determine if continued maintenance/expansion is worthwhile
- Prevent data loss: Unfortunately, I lost 4-5 months of early data before implementing this!
The current dataset shows clear usage patterns that help guide development priorities.
- "Workflow failed" → Check token permissions (needs repository access)
- "Permission denied" → Enable "Read and write permissions" in Actions settings
- "No data collected" → Verify repository name/owner in workflow file
- "Schedule not working" → Remember GitHub Actions use UTC time
- Manual trigger: Use "Run workflow" button in Actions tab for testing
- Check logs: Click on failed workflow runs to see detailed error messages
- Validate token: Ensure your personal access token hasn't expired
Found this useful? Consider:
- Starring this repository
- Reporting issues you encounter
- Suggesting improvements
MIT License - use freely for your projects!
Stop losing your GitHub traffic data! Set up git_traffik in under 5 minutes.







