{"id":50741178,"url":"https://github.com/bytebase/oncall","last_synced_at":"2026-06-10T17:02:12.465Z","repository":{"id":360627153,"uuid":"1139588332","full_name":"bytebase/oncall","owner":"bytebase","description":null,"archived":false,"fork":false,"pushed_at":"2026-05-27T06:43:01.000Z","size":51,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-27T08:23:09.198Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bytebase.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"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":"2026-01-22T06:39:25.000Z","updated_at":"2026-05-27T06:43:05.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/bytebase/oncall","commit_stats":null,"previous_names":["bytebase/oncall"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/bytebase/oncall","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytebase%2Foncall","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytebase%2Foncall/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytebase%2Foncall/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytebase%2Foncall/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bytebase","download_url":"https://codeload.github.com/bytebase/oncall/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytebase%2Foncall/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34161284,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2026-06-10T17:02:11.523Z","updated_at":"2026-06-10T17:02:12.460Z","avatar_url":"https://github.com/bytebase.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Oncall Rotation System\n\nAutomated oncall rotation management system that syncs the current oncall schedule to a Google Group.\n\n## Overview\n\nThis repository contains:\n- **`dev.oncall`**: Oncall rotation schedule (CSV format)\n- **`synconcall/`**: Go CLI tool that syncs current rotation to Google Group\n- **GitHub Actions**: Automated daily sync workflow\n\n## Quick Start\n\n### Schedule File Format\n\nEdit `dev.oncall` to define your rotation schedule:\n\n```csv\n2026-01-12T00:00:00Z,d@bytebase.com,vh@bytebase.com\n2026-02-09T00:00:00Z,vh@bytebase.com,xz@bytebase.com\n2026-03-09T00:00:00Z,xz@bytebase.com,zp@bytebase.com\n```\n\nEach line: `start_time,primary_email,secondary_email`\n- Timestamps in RFC3339 format (ISO 8601)\n- Rotations in chronological order\n- Each rotation period starts at the specified timestamp\n\n### How It Works\n\n1. GitHub Actions runs daily (configurable)\n2. Reads `dev.oncall` to determine current rotation\n3. Syncs Google Group membership to match current primary + secondary\n4. Old oncall members are removed, current ones are added\n\nThe sync is **declarative** - the group always reflects exactly who is currently oncall.\n\n## Setup\n\n**Service Account:** `dev-tools@bytebase-dev.iam.gserviceaccount.com`\n\n### 1. Create Service Account\n\n1. Go to [Google Cloud Console](https://console.cloud.google.com/)\n2. Create a service account\n3. Download JSON key file\n4. Enable domain-wide delegation\n\n### 2. Grant API Permissions\n\nIn Google Workspace Admin Console:\n1. Go to Security \u003e API Controls \u003e Domain-wide Delegation\n2. Add the service account client ID\n3. Grant OAuth scopes (comma-separated):\n   - `https://www.googleapis.com/auth/admin.directory.group,https://www.googleapis.com/auth/admin.directory.group.member`\n\n**Note:** The service account uses domain-wide delegation to impersonate a domain admin user (`d@bytebase.com`) to access the Admin SDK.\n\n### 3. Configure GitHub Secrets\n\nAdd repository secret:\n- Name: `GOOGLE_SERVICE_ACCOUNT`\n- Value: Contents of the service account JSON key file\n\n### 4. Customize Workflow\n\nEdit `.github/workflows/sync-oncall.yml`:\n- Change cron schedule (default: daily at midnight UTC)\n- Update group email if different from `dev-oncall@bytebase.com`\n\n## Manual Sync\n\nBuild and run locally:\n\n```bash\ncd synconcall\ngo build -o synconcall\n\nGOOGLE_CREDENTIALS=\"$(cat /path/to/service-account.json)\" \\\n  ./synconcall --config=../dev.oncall --group=dev-oncall@bytebase.com --admin-user=d@bytebase.com\n```\n\n## Updating the Schedule\n\n1. Edit `dev.oncall` to add new rotation periods\n2. Commit and push changes\n3. Next scheduled run will pick up the changes\n4. Or trigger manually: Actions tab → \"Sync Oncall to Google Group\" → Run workflow\n\n## Project Structure\n\n```\noncall/\n├── dev.oncall                     # Rotation schedule\n├── synconcall/                    # Sync tool\n│   ├── main.go                   # CLI entry point\n│   ├── schedule.go               # Schedule parsing\n│   ├── groups.go                 # Google API client\n│   ├── sync.go                   # Sync logic\n│   ├── *_test.go                 # Comprehensive tests\n│   └── README.md                 # Tool documentation\n├── .github/workflows/\n│   └── sync-oncall.yml           # Automated sync workflow\n└── docs/plans/\n    └── 2026-01-23-oncall-sync-design.md  # Design document\n```\n\n## Testing\n\nRun tests:\n```bash\ncd synconcall\ngo test -v\n```\n\n## Troubleshooting\n\n### Sync fails with authentication error\n- Check service account has domain-wide delegation enabled\n- Verify OAuth scopes are granted correctly\n- Ensure JSON key is valid in GitHub secrets\n\n### Members not updating\n- Check schedule file format (timestamps, emails)\n- Verify current time falls within a rotation period\n- Check GitHub Actions logs for errors\n\n### Wrong people in group\n- Verify `dev.oncall` has correct rotation schedule\n- Check timestamps are in chronological order\n- Ensure timestamps use RFC3339 format with timezone\n\n## Design Documentation\n\nSee [docs/plans/2026-01-23-oncall-sync-design.md](docs/plans/2026-01-23-oncall-sync-design.md) for detailed design decisions and architecture.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytebase%2Foncall","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbytebase%2Foncall","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytebase%2Foncall/lists"}