A system for tracking GitHub followers with automated data collection, change detection, and a sleek dashboard interface. The system uses GitHub Actions for automation and GitHub Pages for hosting.
TO DO | Status |
---|---|
Display the items on the users profile | ✖️ |
- Automated Follower Tracking: Monitors follower changes every 6 hours via GitHub Actions
- Change Detection: Identifies new followers and unfollowers with logging
- Repository Traffic: Tracks profile repository views and clones (when available)
- Historical Data: Maintains up to 100 historical snapshots with trend analysis
- Live Dashboard: GitHub-styled responsive web interface
- REST API: JSON endpoints for external integration
- Zero Dependencies: Pure JavaScript implementation using only Node.js built-ins
├── .github/workflows/main.yml # GitHub Actions automation
├── scripts/monitor.js # Core monitoring logic
├── docs/index.html # Web dashboard
├── data/ # Generated data files
│ ├── latest.json # Current snapshot
│ ├── stats.json # Summary statistics
│ ├── followers.json # Current followers list
│ └── history.json # Historical data
└── package.json # Project metadata
- Create a new repository named
Github-Profile-Monitor
(or any name) (You can also fork this repository
) The repository must be public for GitHub Pages to work (unless you have GitHub Pro) - Clone the repository locally
- Copy all provided files to your repository:
mkdir -p .github/workflows scripts dashboard data # Copy the workflow file to .github/workflows/main.yml # Copy the monitor script to scripts/monitor.js # Copy the dashboard to docs/index.html # Copy package.json to root
- Go to GitHub Settings > Developer Settings > Personal Access Tokens > Tokens (classic)
- Generate a new token with the following scopes:
repo
(for repository access)read:user
(for user data)read:org
(if monitoring organization followers)
- Copy the token value
- In your repository, go to Settings > Secrets and Variables > Actions
- Add the following secrets:
TOKEN
: Your personal access token from step 2 (Name your tokenTOKEN
or edit the code found though the tree to match your new tokens name)
- Go to Settings > Pages
- Source: Deploy from a branch
- Branch:
main
(or your default branch) - Folder:
/docs
- Save the configuration
- Commit and push all files to your repository
- Go to Actions tab and manually trigger the "Monitor GitHub Followers" workflow
- Wait for the workflow to complete (should take 1-2 minutes)
- Your dashboard will be available at:
https://USERNAME.github.io/REPOSITORY-NAME/
- Runs every 6 hours automatically
- Can be triggered manually
- Executes the monitoring script
- Commits data changes
- Deploys the dashboard to GitHub Pages
Core monitoring logic implementing:
- API Communication: Direct HTTPS requests to GitHub API without external dependencies
- Follower Comparison: Detects new followers and unfollowers by comparing user IDs
- Data Persistence: Saves JSON files to the data directory
- Traffic Monitoring: Fetches repository view/clone statistics
- Error Handling: Comprehensive error handling with informative logging
- Rate Limit Awareness: Handles GitHub API rate limits appropriately
Single-file web application featuring:
- GitHub-Styled UI: Matches GitHub's design system with CSS custom properties
- Responsive Design: Mobile-friendly responsive layout
- Real-time Data: Fetches latest data from JSON endpoints
- Interactive Tabs: Switch between dashboard, followers, and API documentation
- Auto-refresh: Updates data every 5 minutes
- Error Handling: Graceful handling of missing or invalid data
Once deployed, your system exposes the following endpoints:
Endpoint | Description |
---|---|
/data/latest.json |
Current snapshot with profile, followers, and recent changes |
/data/stats.json |
Summary statistics and growth metrics |
/data/history.json |
Historical data (last 100 snapshots) |
/data/followers.json |
Complete current followers list with user details |
// Fetch current stats
const response = await fetch('https://USERNAME.github.io/REPOSITORY-NAME/data/stats.json');
const stats = await response.json();
console.log(`Current followers: ${stats.current_followers}`);
console.log(`7-day growth: ${stats.growth_7d}`);
// Fetch latest changes
const latest = await fetch('https://USERNAME.github.io/REPOSITORY-NAME/data/latest.json');
const data = await latest.json();
console.log(`New followers: ${data.changes.new_followers.length}`);
{
"timestamp": "2024-01-15T12:00:00.000Z",
"profile": {
"login": "username",
"name": "Display Name",
"bio": "User bio",
"followers_count": 150,
"following_count": 75,
"public_repos": 25,
"avatar_url": "https://avatars.githubusercontent.com/u/..."
},
"followers": {
"count": 150,
"list": [...]
},
"changes": {
"new_followers": [...],
"unfollowers": [...]
},
"traffic": {
"repository": {...},
"views": {...},
"clones": {...}
}
}
{
"current_followers": 150,
"total_new_followers": 45,
"total_unfollowers": 12,
"growth_7d": 5,
"growth_30d": 18,
"max_followers": 155,
"min_followers": 120,
"avg_followers": 142,
"last_updated": "2024-01-15T12:00:00.000Z",
"monitoring_since": "2024-01-01T00:00:00.000Z"
}
Edit the cron expression in .github/workflows/main.yml
:
schedule:
- cron: '0 */6 * * *' # Every 6 hours
# - cron: '0 */1 * * *' # Every hour
# - cron: '0 0 * * *' # Daily at midnight
Modify the history limit in scripts/monitor.js
:
// Keep last 100 entries
if (history.length > 100) {
history.splice(100); // Change 100 to desired limit
}
The dashboard uses CSS custom properties for theming. Modify the :root
variables in the <style>
section to customize colors and appearance.
-
Workflow fails with "Bad credentials"
- Verify your GitHub token has the correct scopes
- Ensure the token is added as a repository secret named
TOKEN
-
No data appearing on dashboard
- Check that the workflow has run successfully in the Actions tab
- Verify that data files exist in the
data/
directory - Ensure GitHub Pages is configured correctly
-
API rate limit errors
- The system handles rate limits automatically
- Consider reducing monitoring frequency for accounts with many followers
-
Dashboard not loading
- Check browser console for JavaScript errors
- Verify GitHub Pages deployment status
- Ensure all files are in the correct directories
Enable verbose logging by adding debug statements to the monitor script:
console.log('Debug: Current followers count:', followers.length);
console.log('Debug: API response:', JSON.stringify(data, null, 2));
- Token Security: Never commit your GitHub token to the repository
- Scope Limitation: Use minimal required token scopes
- Public Data: All monitored data becomes public via GitHub Pages
- API Limits: System respects GitHub API rate limits
MIT License - See LICENSE file for details
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
For issues and questions:
- Check the troubleshooting section above
- Review GitHub Actions logs for error details
- Open an issue in the repository with detailed information