{"id":49979004,"url":"https://github.com/aimd54/gitlab-reviewer-roulette","last_synced_at":"2026-05-18T14:09:53.014Z","repository":{"id":324300820,"uuid":"1096630763","full_name":"aimd54/gitlab-reviewer-roulette","owner":"aimd54","description":"Intelligent code review assignment system for GitLab with gamification","archived":false,"fork":false,"pushed_at":"2026-02-06T19:29:34.000Z","size":325,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-30T06:11:15.010Z","etag":null,"topics":["automation","code-review","devops","gamification","gitlab","golang","grafana","helm","kubernetes","metrics","prometheus","reviewer-assignment"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aimd54.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-14T17:54:58.000Z","updated_at":"2026-02-06T19:29:37.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/aimd54/gitlab-reviewer-roulette","commit_stats":null,"previous_names":["aimd54/gitlab-reviewer-roulette"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/aimd54/gitlab-reviewer-roulette","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimd54%2Fgitlab-reviewer-roulette","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimd54%2Fgitlab-reviewer-roulette/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimd54%2Fgitlab-reviewer-roulette/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimd54%2Fgitlab-reviewer-roulette/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aimd54","download_url":"https://codeload.github.com/aimd54/gitlab-reviewer-roulette/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimd54%2Fgitlab-reviewer-roulette/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33180395,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-18T09:27:30.708Z","status":"ssl_error","status_checked_at":"2026-05-18T09:27:28.300Z","response_time":71,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","code-review","devops","gamification","gitlab","golang","grafana","helm","kubernetes","metrics","prometheus","reviewer-assignment"],"created_at":"2026-05-18T14:09:52.273Z","updated_at":"2026-05-18T14:09:52.999Z","avatar_url":"https://github.com/aimd54.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GitLab Reviewer Roulette Bot\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\n[![CI](https://github.com/aimd54/gitlab-reviewer-roulette/actions/workflows/ci.yml/badge.svg)](https://github.com/aimd54/gitlab-reviewer-roulette/actions/workflows/ci.yml)\n[![Security](https://github.com/aimd54/gitlab-reviewer-roulette/actions/workflows/security.yml/badge.svg)](https://github.com/aimd54/gitlab-reviewer-roulette/actions/workflows/security.yml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/aimd54/gitlab-reviewer-roulette)](https://goreportcard.com/report/github.com/aimd54/gitlab-reviewer-roulette)\n\nAn intelligent code review assignment system for GitLab that automatically selects reviewers based on availability, workload, expertise, and team distribution. Includes gamification features and comprehensive metrics.\n\n## Features\n\n- 🎲 **Smart Reviewer Selection**: Automatically assigns 3 reviewers (code owner, team member, external) via `/roulette` command\n- 📊 **Intelligent Weighting**: Considers current workload, recent activity, and expertise\n- 🚦 **Availability Management**: Checks GitLab status and OOO entries\n- 🌐 **Multilingual**: Bot responses in English and French\n- 📈 **Metrics \u0026 Analytics**: Track TTFR, Time to Approval, Review Thoroughness\n- 🏆 **Gamification**: Badges, leaderboards, and personal statistics with REST API\n- 💬 **Daily Notifications**: Mattermost reminders for pending reviews\n- 📉 **Prometheus Integration**: Export metrics to Prometheus/Grafana\n\n## Requirements\n\n- **Go** 1.25+\n- **PostgreSQL** 15+\n- **Redis** 6+\n- **Docker \u0026 Docker Compose** (for development)\n- **GitLab** 16.11+\n- **Make** (recommended)\n\n## Quick Start\n\n**One-command setup** for local development and testing:\n\n```bash\n# 1. Check prerequisites\nmake check-env\n\n# 2. Setup everything (automated)\nmake setup-complete\n```\n\nThis command will:\n\n- Build Docker image\n- Start PostgreSQL, Redis, GitLab, and the app\n- Configure GitLab with test users, projects, and webhooks\n- Run database migrations and seed data\n- Wait for services to be ready (5-10 minutes for GitLab)\n\n**Access:**\n\n- **App**: \u003chttp://localhost:8080\u003e\n- **GitLab**: \u003chttp://localhost:8000\u003e\n- **Metrics**: \u003chttp://localhost:9090/metrics\u003e\n\n**Test it:** Create a merge request in GitLab and comment `/roulette`\n\n**Common commands:**\n\n```bash\nmake logs       # Follow all logs\nmake restart    # Restart app\nmake down       # Stop everything\nmake status     # Show service status\nmake help       # See all commands\n```\n\n## Configuration\n\nThe app uses `config.yaml` for structure (teams, badges) and environment variables for secrets.\n\n### Quick Setup\n\n1. Copy template: `cp config.example.yaml config.yaml`\n2. Edit teams to match your GitLab users\n3. Set environment variables for secrets\n\n### Key Environment Variables\n\n```bash\n# GitLab\nGITLAB_URL=https://gitlab.example.com\nGITLAB_TOKEN=glpat-your-token-here\nGITLAB_WEBHOOK_SECRET=your-secret-here\n\n# Database\nPOSTGRES_HOST=localhost\nPOSTGRES_PASSWORD=your-password\n\n# Redis\nREDIS_HOST=localhost\n\n# Server\nSERVER_LANGUAGE=en  # or 'fr'\nLOG_LEVEL=info\n```\n\n### Customization\n\nEdit `config.yaml` to configure:\n\n- **Team Structure**: Define teams, members, and roles\n- **Badge Thresholds**: Adjust based on team size\n- **Timezone**: Set scheduler timezone\n- **File Expertise**: Configure file patterns for dev/ops roles\n\n**Full reference:** See [config.example.yaml](./config.example.yaml) for all options with inline documentation.\n\n## Production Deployment\n\n### Kubernetes (Recommended)\n\n```bash\nhelm install reviewer-roulette ./helm/reviewer-roulette \\\n  --set config.gitlab.url=https://gitlab.example.com \\\n  --set config.gitlab.token=$GITLAB_TOKEN \\\n  --set config.gitlab.webhookSecret=$WEBHOOK_SECRET \\\n  --namespace reviewer-roulette \\\n  --create-namespace\n```\n\n**Features:**\n\n- High availability (2+ replicas)\n- Horizontal autoscaling (HPA)\n- Automatic migrations (init container)\n- Prometheus ServiceMonitor\n- TLS ingress support\n\nSee [helm/reviewer-roulette/README.md](helm/reviewer-roulette/README.md) for complete docs.\n\n### Docker\n\nPre-built multi-architecture images available on GitHub Container Registry:\n\n```bash\n# Pull image\ndocker pull ghcr.io/aimd54/gitlab-reviewer-roulette:1.8.0\n\n# Run\ndocker run -d \\\n  --name reviewer-roulette \\\n  -p 8080:8080 \\\n  -p 9090:9090 \\\n  -v $(pwd)/config.yaml:/app/config.yaml \\\n  -e GITLAB_TOKEN=$GITLAB_TOKEN \\\n  -e POSTGRES_PASSWORD=$DB_PASSWORD \\\n  ghcr.io/aimd54/gitlab-reviewer-roulette:1.8.0\n```\n\n**Available tags:** `latest`, `1.8.0`, `1.8`, `1`\n**Architectures:** linux/amd64, linux/arm64\n\n### Docker Compose\n\nFor small deployments:\n\n```bash\nmake start           # Start services\nmake docker-migrate  # Run migrations\nmake docker-init     # Sync users from GitLab\n```\n\n## Usage\n\n### GitLab Webhook Setup\n\n1. Navigate to: Project/Group → Settings → Webhooks\n2. Configure:\n   - **URL**: `https://your-server.com/webhook/gitlab`\n   - **Secret**: Your `GITLAB_WEBHOOK_SECRET` value\n   - **Triggers**: ✅ Comments, ✅ Merge request events\n   - **SSL**: ✅ Enable verification\n3. Click \"Add webhook\"\n\n### Trigger Reviewer Selection\n\nIn any Merge Request, post:\n\n```\n/roulette\n```\n\nBot response:\n\n```\n🎲 Reviewer Roulette Results:\n• Code Owner: @alice (3 active reviews)\n• Team Member: @bob (1 active review)\n• External Reviewer: @charlie from Team-Platform (2 active reviews)\n```\n\n### Command Variations\n\n```bash\n/roulette                          # Standard selection\n/roulette --force                  # Override recent review penalties\n/roulette --include @user1         # Force include users\n/roulette --exclude @user2         # Exclude users\n/roulette --no-codeowner           # Skip codeowner\n```\n\n## API Endpoints\n\n### Core\n\n- `POST /webhook/gitlab` - Receive GitLab webhooks\n- `GET /health` - Health check\n- `GET /metrics` - Prometheus metrics (port 9090)\n\n### Dashboard API (Public, Read-Only)\n\n- `GET /api/v1/leaderboard` - Global leaderboard\n- `GET /api/v1/leaderboard/:team` - Team leaderboard\n- `GET /api/v1/users/:id/stats` - User statistics\n- `GET /api/v1/users/:id/badges` - User badges\n- `GET /api/v1/badges` - Badge catalog\n- `GET /api/v1/badges/:id` - Badge details\n- `GET /api/v1/badges/:id/holders` - Badge holders\n\n## Development\n\n### Project Structure\n\n```\ncmd/\n  ├── server/      # Main API server\n  ├── migrate/     # Database migrations\n  └── init/        # User sync from GitLab\ninternal/\n  ├── api/         # HTTP handlers (webhook, dashboard)\n  ├── service/     # Business logic (roulette, metrics)\n  ├── repository/  # Data access (GORM)\n  ├── gitlab/      # GitLab API client\n  └── cache/       # Redis wrapper\n```\n\n### Common Make Commands\n\n```bash\n# Setup \u0026 Running\nmake setup-complete    # Complete setup\nmake start             # Start services\nmake logs              # View logs\nmake status            # Service status\n\n# Database\nmake migrate           # Run migrations (auto-detect)\nmake seed              # Seed test data\n\n# Development\nmake build             # Build binaries\nmake test              # Run tests\nmake check             # All quality checks\nmake fmt               # Format code\nmake lint              # Run linters\n\n# Quality \u0026 Security\nmake install-tools     # Install dev tools\nmake security          # Security scan\nmake vuln-check        # Check vulnerabilities\n\n# See all commands\nmake help\n```\n\nFor complete development guidelines, see [CONTRIBUTING.md](./CONTRIBUTING.md).\n\n**Local Kubernetes Testing:** For testing the Helm chart in a local Kubernetes cluster (Kind/k3d), see [examples/kind/](./examples/kind/) for minimal manifests and instructions.\n\n### Running Tests\n\n```bash\nmake test               # All tests with coverage\nmake test-short         # Quick tests (no race detector)\ngo test -v ./internal/service/roulette/...  # Specific package\n```\n\n## Troubleshooting\n\n**Webhook not received:**\n\n- Check GitLab webhook logs (Settings → Webhooks → Recent Deliveries)\n- Verify URL is accessible and secret matches\n- Review app logs: `make logs-app`\n\n**No reviewers selected:**\n\n- Verify team config in `config.yaml`\n- Check user availability in GitLab\n- Ensure CODEOWNERS file exists (if needed)\n\n**Database/Redis connection failed:**\n\n- Check services: `docker compose ps`\n- Verify connection params in config\n- Apply migrations: `make migrate`\n\n**GitLab not starting:**\n\n- Check logs: `docker logs gitlab`\n- GitLab takes 5-10 minutes to initialize\n- Ensure 4GB+ RAM available\n\nFor more issues, see application logs or open an issue on GitHub.\n\n## Documentation\n\n- **[README.md](README.md)** (this file) - Overview and quick start\n- **[ARCHITECTURE.md](ARCHITECTURE.md)** - System design and architecture\n- **[CONTRIBUTING.md](CONTRIBUTING.md)** - Development guidelines and quality standards\n- **[SECURITY.md](SECURITY.md)** - Security policy and vulnerability reporting\n- **[METRICS.md](METRICS.md)** - Metrics, Prometheus, Grafana dashboards\n- **[CHANGELOG.md](CHANGELOG.md)** - Version history and changes\n- **[config.example.yaml](config.example.yaml)** - Complete configuration reference\n- **[helm/reviewer-roulette/README.md](helm/reviewer-roulette/README.md)** - Helm chart documentation\n\n## Contributing\n\nWe welcome contributions! Quick start:\n\n```bash\nmake install-tools         # Install dev tools\nmake pre-commit-install    # Install hooks\nmake check                 # Run quality checks\n```\n\n**Commit format:** [Conventional Commits](https://www.conventionalcommits.org/)\nExample: `feat(roulette): add expertise matching`\n\n**Quality standards:**\n\n- Code formatting (gofmt)\n- Linting (golangci-lint)\n- \u003e80% test coverage for business logic\n- Security checks (gosec, govulncheck)\n\nSee [CONTRIBUTING.md](./CONTRIBUTING.md) for complete guidelines.\n\n## License\n\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faimd54%2Fgitlab-reviewer-roulette","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faimd54%2Fgitlab-reviewer-roulette","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faimd54%2Fgitlab-reviewer-roulette/lists"}