A collection of configurable scripts for tracking team metrics across GitHub repositories and SonarQube projects.
These scripts provide automated reporting for:
- SonarQube Code Quality Metrics - Technical debt, coverage, bugs, vulnerabilities
- Weekly Team Reports - PR activity, feature delivery, issue tracking
- Monthly DORA Metrics - Deployment frequency, lead time, failure rates
Copy the template and customize for your team:
cp config.template.sh config-your-repo.shEdit config-your-repo.sh with your team's settings:
- Repository information
- Search criteria for your team's work
- SonarQube project details (if applicable)
# Generate SonarQube quality report
./sonarqube-metrics.sh config-your-repo.sh
# Create weekly team report
./weekly-report.sh config-your-repo.sh
# Generate monthly DORA metrics
./monthly-dora.sh config-your-repo.shconfig.template.sh- Configuration template (copy this for each repo)sonarqube-metrics.sh- Code quality metrics from SonarQubeweekly-report.sh- Weekly team activity reportmonthly-dora.sh- Monthly DORA metrics analysis
REPO_ORG="your-org"
REPO_NAME="your-repo-name"
REPO="${REPO_ORG}/${REPO_NAME}"
TEAM_NAME="Your Team Name"Prefix-based (default):
SEARCH_CRITERIA="TEAM-"
FEATURE_SEARCH="feat(TEAM-"
BUGFIX_SEARCH="fix(TEAM-"Label-based:
SEARCH_CRITERIA="label:backend"
FEATURE_SEARCH="feat label:backend"
BUGFIX_SEARCH="fix label:backend"Author-based:
SEARCH_CRITERIA="author:teamname"
FEATURE_SEARCH="feat author:teamname"
BUGFIX_SEARCH="fix author:teamname"Milestone-based:
SEARCH_CRITERIA="milestone:sprint-1"
FEATURE_SEARCH="feat milestone:sprint-1"
BUGFIX_SEARCH="fix milestone:sprint-1"SONAR_URL="https://your-sonarqube-instance.com"
SONAR_PROJECT_KEY="your-project-key"
SONAR_USERNAME="your_token_here" # User token goes here
SONAR_PASSWORD="" # Leave empty for token authFor teams working across multiple repositories, create separate config files:
# Backend repository
cp config.template.sh config-backend.sh
# Edit config-backend.sh
# Frontend repository
cp config.template.sh config-frontend.sh
# Edit config-frontend.sh
# Generate reports for each repo
./weekly-report.sh config-backend.sh
./weekly-report.sh config-frontend.sh./sonarqube-metrics.sh [config-file] [format]format:summary(default),table,json
Examples:
./sonarqube-metrics.sh config-backend.sh summary
./sonarqube-metrics.sh config-frontend.sh json./weekly-report.sh [config-file]Generates markdown file: {REPORT_PREFIX}-YYYY-WWW.md
./monthly-dora.sh [config-file]Console output with deployment frequency, lead time, failure rates, and team health indicators.
# Team Name Weekly Report
**Repository: org/repo**
**Week of 2024-01-01 to 2024-01-07**
## π― Key Metrics Summary
- **Features Merged**: 5
- **Bug Fixes Merged**: 2
- **Total PRs Merged**: 7
## π Detailed Metrics
### Features Merged This Week
- [feat(TEAM-123): Add new dashboard](link) (merged 2024-01-05)
### Open Items Needing Attention
**Critical Items:**
**Stale PRs (older than 3 days):**π DEPLOYMENT FREQUENCY:
Features Deployed: 15
Hotfixes Deployed: 3
Total Deployments: 18
β±οΈ LEAD TIME FOR CHANGES:
Recently merged PRs: 20
π CHANGE FAILURE RATE:
Failure Rate: 16.67% (3 hotfixes out of 18 deployments)
gh(GitHub CLI) - Installation Guidejq(JSON processor) -brew install jqorapt-get install jqcurl(for SonarQube API calls)bc(basic calculator for DORA calculations)
gh auth login- Read access to target repositories
- SonarQube project access (for quality metrics)
SonarQube connection fails
- Verify
SONAR_URLis accessible - Check
SONAR_USERNAMEtoken has project permissions - Test:
curl -u "token:" "$SONAR_URL/api/projects/search"
When adding new metrics or features:
- Update the configuration template if new settings are needed
- Maintain backward compatibility
- Update this README with new options
- Test with multiple repository configurations
GitHub search supports complex queries:
# Multiple labels
SEARCH_CRITERIA="label:backend label:urgent"
# Date ranges
SEARCH_CRITERIA="created:>2024-01-01"
# Multiple authors
SEARCH_CRITERIA="author:dev1 author:dev2"
# Combine criteria
SEARCH_CRITERIA="label:feature author:teamlead created:>2024-01-01"Add team-specific metrics by extending the scripts:
# In your config file
CUSTOM_LABEL_SEARCH="label:performance"
HOTFIX_SEARCH="hotfix("
# Use in scripts
PERFORMANCE_PRS=$(gh pr list --repo $REPO --search "$CUSTOM_LABEL_SEARCH" ...)