All scripts were generated with the assistance of GitHub Copilot.
Bash First: These scripts prioritize Bash whenever possible for simplicity and portability. Python is only used when advanced data processing (pandas, numpy) or complex analysis is required.
GitHub CLI Recommended: For most GitHub API interactions, consider using the GitHub CLI instead of custom scripts. The scripts here demonstrate API usage patterns and handle specific use cases not covered by the CLI.
inactive_copilot.sh- Identifies Copilot users active and inactive within 90 dayscompare_ghe_copilot_licenses.sh- License Gap Analysis - Compares GitHub Enterprise Managed Users with Copilot licenses to identify users who have enterprise licenses but no Copilot license. Perfect for license optimization and provisioning planning.# Basic usage (using GitHub CLI authentication) gh auth login # One-time setup ./compare_ghe_copilot_licenses.sh --enterprise your-enterprise # Complete analysis with all output formats ./compare_ghe_copilot_licenses.sh \ --enterprise your-enterprise \ --out license_audit_$(date +%Y%m%d) \ --markdown --csv --json # Test mode with sample data (no authentication required) ./compare_ghe_copilot_licenses.sh --enterprise demo --test-mode --markdown --csv
- Required Permissions: Enterprise admin access, Copilot billing access
- Key Output:
license_gaps_emu_only.json- EMU users missing Copilot licenses - Reports: JSON summary, CSV export, Markdown report with recommendations
- Features: Test mode, comprehensive logging, license coverage analysis
compare_emu_ghec_users.sh- EMU vs GHEC User Comparison - Compares users between a GitHub Enterprise Managed User (EMU) instance and a GitHub Enterprise Cloud (GHEC) organization or enterprise. Uses SCIM API for EMU and GraphQL for GHEC. Full Documentation →# Simple comparison ./user_management/compare_emu_ghec_users.sh --emu-enterprise my-emu --ghec-org my-org --csv # With account switching (EMU vs non-EMU accounts) ./user_management/compare_emu_ghec_users.sh \ --emu-enterprise my-emu \ --emu-account user_emu \ --ghec-enterprise my-ghec \ --ghec-account user_regular \ --csv --markdown
- Version: 1.1.0
- Required Permissions: EMU enterprise admin, GHEC org/enterprise access
- Key Features:
- Automatic account switching for cross-account access
- Supports both GHEC organizations and enterprises
- Identifies provisioning gaps and external collaborators
- Multiple output formats (JSON, CSV, Markdown)
- Requirements: SAML SSO must be configured on GHEC target
- Documentation: See USAGE_compare_emu_ghec.md for complete guide
plot_copilot_json.py- Generates Copilot Enterprise Dashboard user-level metrics visualizations from exported JSON data. Outputs dashboard-ready PNGs for code activity, engagement, feature usage, acceptance rate, IDE usage, and language diversity per user. Usage:/path/to/python ./copilot/plot_copilot_json.py <json_file> <output_dir>
- Only dashboard_* PNGs are produced (no duplicates)
- Requires: pandas, matplotlib, seaborn
- Example output files:
- dashboard_user_code_activity.png
- dashboard_user_engagement_heatmap.png
- dashboard_feature_usage_by_user.png
- dashboard_acceptance_rate_per_user.png
- dashboard_ide_usage_by_user.png
- dashboard_language_diversity_per_user.png
owner_dr.sh- Creates text-based backups of organization owners in an enterprise and allows restoration of these permissions
ignore_secrets.sh- Fetches secret scanning alerts, filters by commit dates to identify when secrets were introduced, and resolves them as false positives
get_commits.sh- Gathers commit counts for repositories across an organization over the last 3 monthsgithub_emu_report.sh- Generates EMU (Enterprise Managed User) reports
get_commits.py- Advanced commit analysis with data processing capabilities
list_teams.sh- Lists teams in an organization with more than 5 members (useful for identifying teams eligible for Copilot team metrics)
- GitHub CLI installed and authenticated (
gh auth login) - Security Note: GitHub CLI provides secure authentication without exposing tokens in command line or environment variables
# Install required packages
pip install pandas requests pyarrow matplotlib seaborn- Copilot scripts:
manage_billing:copilotorread:enterprise - Organization scripts:
read:org,admin:org(for management operations) - Repository scripts:
repo - Security scripts:
security_events
-
Set up authentication:
export GITHUB_TOKEN=your_token_here # or use GitHub CLI gh auth login
-
Make scripts executable:
find . -name "*.sh" -exec chmod +x {} \;
-
Run a script:
# Bash script example ./copilot/inactive_copilot.sh your-org # Python script example python copilot/copilot_dda_complete.py your-enterprise --since 2025-06-01
- Bash Compatibility: Scripts use
#!/usr/bin/env bashshebang for portability - Shell Version: Compatible with Bash < 4.0 (no associative arrays)
- Error Handling: All scripts include comprehensive error checking and usage documentation
- Output: Most scripts provide both human-readable output and CSV/JSON for further processing