A Go-based tool that analyzes and exports commit data from GitHub organization repositories for specific team members. This tool helps track team contributions across multiple repositories by generating detailed CSV reports of commits.
- Organization-wide Analysis: Scans all private repositories in a GitHub organization
- Team Member Filtering: Extracts commits only from specified team members
- Date Range Filtering: Supports filtering commits from a specific date onwards
- Concurrent Processing: Uses configurable concurrency for efficient API usage
- CSV Export: Generates detailed CSV reports with commit information
- Rate Limit Handling: Automatically handles GitHub API rate limits
- Error Resilience: Gracefully handles missing repositories and access issues
- Go 1.24.2 or later
- GitHub Personal Access Token with appropriate permissions
- Access to the target GitHub organization
- Clone this repository:
git clone <repository-url>
cd tools- Install dependencies:
go mod downloadgo run main.go -token=<your_github_token> -org=<organization_name> -members=<comma_separated_usernames>go run main.go [OPTIONS]-token: GitHub fine-grained personal access token-org: GitHub organization name-members: Comma-separated list of GitHub usernames to analyze
-since: Get commits since this date (format: YYYY-MM-DD, default: all commits)-output: Output CSV file name (default: "commits.csv")-concurrency: Number of concurrent repository processing threads (default: 10)
go run main.go \
-token=github_pat_xxxxxxxxxxxxx \
-org=MyCompany \
-members=john.doe,jane.smith,bob.wilson \
-since=2024-01-01 \
-output=team_commits_2024.csv \
-concurrency=5The tool generates a CSV file with the following columns:
| Column | Description |
|---|---|
| Repository | Name of the repository |
| Commit | Full SHA hash of the commit |
| Author | GitHub username of the commit author |
| Message | Commit message (cleaned of newlines) |
| Date | Commit date in YYYY-MM-DD HH:MM:SS format |
| URL | Direct link to the commit on GitHub |
- Go to GitHub Settings → Developer settings → Personal access tokens → Fine-grained tokens
- Create a new token with the following permissions for your organization:
- Repository access: All repositories (or specific repositories)
- Repository permissions:
- Contents: Read
- Metadata: Read
- Pull requests: Read (if analyzing PR commits)
- Repository Discovery: Fetches all private repositories from the specified organization
- Concurrent Processing: Processes multiple repositories simultaneously using goroutines
- Commit Extraction: Retrieves all commits from each repository (optionally filtered by date)
- Team Member Filtering: Filters commits to include only those authored by specified team members
- Data Export: Compiles all matching commits into a structured CSV report
The tool handles various scenarios gracefully:
- Rate Limiting: Automatically waits when GitHub API rate limits are hit
- Missing Repositories: Skips repositories that are not found or inaccessible
- Empty Repositories: Handles repositories with no commits
- Network Issues: Provides clear error messages for connection problems
- Concurrency: Adjust the
-concurrencyparameter based on your API rate limits - Date Filtering: Use the
-sinceparameter to limit the scope and improve performance - Large Organizations: For organizations with many repositories, consider running during off-peak hours
github.com/google/go-github/v71: GitHub API client librarygolang.org/x/oauth2: OAuth2 authentication for GitHub API
This project is provided as-is for internal tooling purposes.
When making changes to this tool:
- Ensure backward compatibility with existing command-line parameters
- Test with various organization sizes and team configurations
- Verify CSV output format remains consistent
- Update this README if adding new features
"Error getting repositories: 401"
- Check that your GitHub token is valid and has the correct permissions
"Hit rate limit"
- Reduce the
-concurrencyparameter or wait for rate limits to reset
"Repository not found or no access"
- Ensure your token has access to the organization's private repositories
Empty CSV output
- Verify team member usernames are spelled correctly
- Check that the specified date range contains commits
- Ensure team members have commits in the organization's repositories# pdax-tools