feat(synconcall): sync oncall rotation to a GitHub team#6
Merged
Conversation
Add a GitHub org team as a third sync target alongside Google Groups and Slack. The current primary + secondary are reconciled into the team on every rotation, mirroring the existing targets. - github.go: GitHubTeamClient implementing the GroupsClient interface via the GitHub REST API, plus a CSV email->username mapping loader. The tool stays email-based; the client translates email<->username internally. - github-users.csv: email -> GitHub username mapping. - main.go: --github-org/--github-team/--github-users/--github-token flags and a GitHub sync block; token also read from GH_TOKEN/GITHUB_TOKEN. - sync-oncall.yml: sync the bytebase-oncall team (GHA_DISPATCH_TOKEN). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ecmadao
approved these changes
Jun 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a GitHub org team as a third sync target for
synconcall, alongside the existing Google Group and Slack user group. On every rotation, the current primary + secondary are reconciled into thebytebase-oncallteam — same semantics as the other two targets.Why
We want an addressable GitHub team (like
bytebase-dev) that always points at whoever is on call, for mentions / reviews / notifications, kept in sync automatically.How
synconcall'sGroupsClientinterface is generic, so GitHub drops in with no change to theSync()reconciliation logic.synconcall/github.go—GitHubTeamClientimplementingListMembers/AddMember/RemoveMemberagainst/orgs/{org}/teams/{slug}/memberships/…(plainnet/http, no new deps), plus a CSV mapping loader. The rotation stays email-based; the client translates email↔username internally (like the Slack client does for Slack IDs).github-users.csv— email → GitHub username mapping (GitHub teams are username-keyed; the schedule is email-keyed).synconcall/main.go—--github-org,--github-team,--github-users,--github-tokenflags + a GitHub sync block. Token also read fromGH_TOKEN/GITHUB_TOKEN..github/workflows/sync-oncall.yml— runs the sync for orgbytebase, teambytebase-oncall, usingsecrets.GHA_DISPATCH_TOKEN.Note: the team is fully reconciled to the current on-call pair, so manually-added members are removed on the next run — matching the existing Google/Slack behavior.
Before this works
gh api -X POST orgs/bytebase/teams -f name='bytebase-oncall' -f description='Current on-call primary + secondary (auto-synced)' -f privacy='closed'(needsadmin:org).secrets.GHA_DISPATCH_TOKENhas org Members: write.Testing
go build,go vet, andgo test ./...pass.synconcall/github_test.gocovering the mapping loader (valid + malformed) and the email↔username reverse map.🤖 Generated with Claude Code