Automated oncall rotation management system that syncs the current oncall schedule to a Google Group.
This repository contains:
dev.oncall: Oncall rotation schedule (CSV format)synconcall/: Go CLI tool that syncs current rotation to Google Group- GitHub Actions: Automated daily sync workflow
Edit dev.oncall to define your rotation schedule:
2026-01-12T00:00:00Z,d@bytebase.com,vh@bytebase.com
2026-02-09T00:00:00Z,vh@bytebase.com,xz@bytebase.com
2026-03-09T00:00:00Z,xz@bytebase.com,zp@bytebase.comEach line: start_time,primary_email,secondary_email
- Timestamps in RFC3339 format (ISO 8601)
- Rotations in chronological order
- Each rotation period starts at the specified timestamp
- GitHub Actions runs daily (configurable)
- Reads
dev.oncallto determine current rotation - Syncs Google Group membership to match current primary + secondary
- Old oncall members are removed, current ones are added
The sync is declarative - the group always reflects exactly who is currently oncall.
Service Account: dev-tools@bytebase-dev.iam.gserviceaccount.com
- Go to Google Cloud Console
- Create a service account
- Download JSON key file
- Enable domain-wide delegation
In Google Workspace Admin Console:
- Go to Security > API Controls > Domain-wide Delegation
- Add the service account client ID
- Grant OAuth scopes (comma-separated):
https://www.googleapis.com/auth/admin.directory.group,https://www.googleapis.com/auth/admin.directory.group.member
Note: The service account uses domain-wide delegation to impersonate a domain admin user (d@bytebase.com) to access the Admin SDK.
Add repository secret:
- Name:
GOOGLE_SERVICE_ACCOUNT - Value: Contents of the service account JSON key file
Edit .github/workflows/sync-oncall.yml:
- Change cron schedule (default: daily at midnight UTC)
- Update group email if different from
dev-oncall@bytebase.com
Build and run locally:
cd synconcall
go build -o synconcall
GOOGLE_CREDENTIALS="$(cat /path/to/service-account.json)" \
./synconcall --config=../dev.oncall --group=dev-oncall@bytebase.com --admin-user=d@bytebase.com- Edit
dev.oncallto add new rotation periods - Commit and push changes
- Next scheduled run will pick up the changes
- Or trigger manually: Actions tab → "Sync Oncall to Google Group" → Run workflow
oncall/
├── dev.oncall # Rotation schedule
├── synconcall/ # Sync tool
│ ├── main.go # CLI entry point
│ ├── schedule.go # Schedule parsing
│ ├── groups.go # Google API client
│ ├── sync.go # Sync logic
│ ├── *_test.go # Comprehensive tests
│ └── README.md # Tool documentation
├── .github/workflows/
│ └── sync-oncall.yml # Automated sync workflow
└── docs/plans/
└── 2026-01-23-oncall-sync-design.md # Design document
Run tests:
cd synconcall
go test -v- Check service account has domain-wide delegation enabled
- Verify OAuth scopes are granted correctly
- Ensure JSON key is valid in GitHub secrets
- Check schedule file format (timestamps, emails)
- Verify current time falls within a rotation period
- Check GitHub Actions logs for errors
- Verify
dev.oncallhas correct rotation schedule - Check timestamps are in chronological order
- Ensure timestamps use RFC3339 format with timezone
See docs/plans/2026-01-23-oncall-sync-design.md for detailed design decisions and architecture.