Generate comprehensive GitHub activity reports with AI-powered narratives. Perfect for standup meetings, performance reviews, or tracking your open source contributions.
-
📊 Comprehensive Activity Tracking
- Pull requests (authored, reviewed, merged)
- Issues (created, engaged, closed)
- Commits (including work-in-progress)
- Maintainer activities
-
🤖 AI-Powered Narratives (Optional)
- Generate human-readable summaries using Google's Gemini API
- Intelligently groups related work
- Professional tone suitable for reports and reviews
-
🔍 Flexible Reporting
- Track activity across multiple repositories and organizations
- Custom date ranges (daily, weekly, monthly, etc.)
- Works with both public and private repositories
-
🔐 Multiple Authentication Methods
- OAuth device flow (recommended for easy setup)
- Personal access tokens
- Environment variables
- Secure local token storage
# Clone the repository
git clone https://github.com/yourusername/github-activity-reporter.git
cd github-activity-reporter
# Install dependencies
pip install -r requirements.txt
# Or use pipx for isolated installation
pipx install pygithub google-genai# First time: Authenticate with OAuth
python github_report.py --oauth-login
# Generate today's activity report
python github_report.py --use-oauth --repos owner/repo
# Specify date range
python github_report.py \
--use-oauth \
--start-date 2024-01-01 \
--end-date 2024-01-31 \
--repos owner/repo org
# Generate AI narrative (requires Gemini API key)
python github_report.py \
--use-oauth \
--narrative \
--repos owner/repo
# Using environment variable instead of OAuth
export GITHUB_TOKEN="your_token_here"
python github_report.py --repos owner/repoYou can authenticate with GitHub in two ways:
OAuth provides a better user experience with automatic token management.
Step 1: Register a GitHub OAuth App (one-time setup)
- Go to GitHub Developer Settings
- Click "OAuth Apps" → "New OAuth App"
- Fill in the registration form:
- Application name:
GitHub Activity Reporter(or your choice) - Homepage URL:
https://github.com/yourusername/github-activity-reporter(or any URL) - Authorization callback URL:
http://localhost(required but not used for device flow)
- Application name:
- Click "Register application"
- Copy the Client ID from the app settings page
Step 2: Set your Client ID
Choose one of these methods:
# Method A: Environment variable (recommended)
export GITHUB_OAUTH_CLIENT_ID="your_client_id_here"
# Method B: Command line flag
python github_report.py --oauth-client-id your_client_id_here --oauth-login
# Method C: Edit github_oauth.py
# Set DEFAULT_CLIENT_ID = "your_client_id_here" in the fileStep 3: Authenticate
# First time: authenticate with OAuth
python github_report.py --oauth-login
# Then run reports normally (uses saved token)
python github_report.py --use-oauth --repos owner/repoThe OAuth flow will:
- Display a verification code
- Open your browser to GitHub
- Prompt you to enter the code
- Save the token locally for future use
To logout and remove saved token:
python github_report.py --oauth-logoutCreate a GitHub Personal Access Token:
- Go to GitHub Settings → Developer settings → Personal access tokens
- Click "Generate new token" (classic)
- Select scopes:
repo,read:org,read:user - Save the token
Then choose one of these methods to provide the token:
A. Using a .env file (recommended for local development):
# Copy the example file
cp .env.example .env
# Edit .env and add your token
# GITHUB_TOKEN=ghp_your_token_here
# Run the script (automatically loads .env)
python github_report.py --repos owner/repoB. Environment variable:
export GITHUB_TOKEN="your_token_here"
python github_report.py --repos owner/repoC. Command line flag:
python github_report.py --token your_token_here --repos owner/repoGet a Gemini API key:
- Visit Google AI Studio
- Create an API key
- Set it as an environment variable:
export GEMINI_API_KEY="your_api_key_here"# Using OAuth (recommended)
python github_report.py \
--use-oauth \
--repos myorg/frontend myorg/backend myorg/docs
# Or with environment variable
python github_report.py \
--repos myorg/frontend myorg/backend myorg/docs# Last week's activity with AI narrative
python github_report.py \
--use-oauth \
--start-date 2024-01-15 \
--end-date 2024-01-21 \
--narrative \
--repos myteam# Track open source contributions
python github_report.py \
--start-date 2024-01-01 \
--end-date 2024-01-31 \
--narrative \
--repos facebook/react vuejs/vue microsoft/vscode# Quarterly report with detailed commits
python github_report.py \
--start-date 2024-01-01 \
--end-date 2024-03-31 \
--narrative \
--gemini-model gemini-2.5-pro \
--repos mycompany > Q1_performance_review.md| Option | Description | Default |
|---|---|---|
--token |
GitHub Personal Access Token | $GITHUB_TOKEN |
--use-oauth |
Use OAuth authentication | False |
--oauth-login |
Authenticate with OAuth and save token | - |
--oauth-logout |
Remove saved OAuth token | - |
--oauth-client-id |
Custom OAuth app client ID | Built-in |
| Option | Description | Default |
|---|---|---|
--start-date |
Start date (YYYY-MM-DD) | Today |
--end-date |
End date (YYYY-MM-DD) | Today |
--repos |
Space-separated list of repos/orgs | Required |
--narrative |
Generate AI narrative summary | False |
--gemini-model |
Gemini model for narratives | gemini-2.5-flash |
- Structured markdown with sections for:
- Pull Requests (with commit details)
- Issues (created and status)
- Work in Progress (orphan commits)
- Maintainer activities (reviews, triage)
- Includes both structured report and narrative summary
- Executive summary
- Thematically grouped accomplishments
- Impact analysis and future directions
- For Team Leads: Use the narrative mode to quickly generate team update emails
- For Contributors: Track contributions across multiple open source projects
- For Performance Reviews: Generate comprehensive activity logs with context
- For Daily Standups: Run with today's date for a quick activity summary
The tool uses the following priority order for authentication:
--tokenflag - Explicit token passed on command line (highest priority)- Saved OAuth token - Used when
--use-oauthis specified or no other token available GITHUB_TOKENenvironment variable - Fallback option
This allows you to mix authentication methods as needed. For example, you can have a saved OAuth token but override it with --token for specific runs.
- The script only accesses repositories you have permission to view
- OAuth tokens are stored locally in
~/.config/github-activity-reporter/with 600 permissions (owner read/write only) - Personal access tokens are never stored (only used at runtime)
- OAuth tokens can be revoked at any time using
--oauth-logoutor via GitHub settings .envfiles containing secrets are excluded from git via.gitignore- Gemini API processes data according to Google's privacy policy
- All data processing happens locally except for optional AI narrative generation
Important: Never commit your .env file or tokens to version control. The .gitignore file is configured to prevent this, but always double-check before pushing.
"GitHub OAuth app client ID is required"
- You need to register a GitHub OAuth App first (see Setup → Option 1)
- Set the client ID using
GITHUB_OAUTH_CLIENT_IDenvironment variable - Or pass it via
--oauth-client-idflag
"404 Client Error: Not Found" during OAuth
- This usually means the OAuth client ID is invalid or not set
- Verify you've registered an OAuth app on GitHub
- Double-check the client ID is correct
"requests library is required for OAuth"
- Install requests:
pip install requests - Or install all dependencies:
pip install -r requirements.txt
OAuth authentication fails
- Try re-authenticating:
python github_report.py --oauth-login - Check your internet connection
- Ensure you completed the authorization in the browser
"No saved token found"
- Run
python github_report.py --oauth-loginto authenticate first - Or use a different auth method (PAT with
--tokenorGITHUB_TOKENenv var)
- Ensure your GitHub token has appropriate permissions
- Check repository names are correct (case-sensitive)
- If using OAuth, verify your token has the required scopes (repo, read:org, read:user)
- Verify date range is correct
- Check that your GitHub username matches the token owner
- Ensure repos parameter includes correct organizations/repositories
- Verify API key is set correctly
- Check API quotas and limits
- Try using a different model (e.g.,
--gemini-model gemini-2.5-flash)
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - see LICENSE file for details
Originally created for personal use, now shared with the community.
- Built with PyGithub
- AI narratives powered by Google Gemini