rust-lang / wg-governance

35 stars 13 forks source link

Synchronize GitHub teams with the team repo #21

Open pietroalbini opened 5 years ago

pietroalbini commented 5 years ago

The team repo is the central place where all the team memberships and permissions are stored. Almost every piece of infrastructure is synchronized with it, and it recently gained support for synchronizing GitHub teams with its data.

Unfortunately enabling the sync code is not as simple as deploying it: there are currently a lot of inconsistencies between team members on the team repo and on GitHub teams, and approval from team leads is needed on the membership diffs that are going to be applied.

The workflow is roughly this:

  1. Pick a team from the repo that is not synchronized with GitHub yet and has no PRs open for it. Teams without synchronization don't have a [github] section in their toml.
  2. Try to add synchronization locally and test the changes with a dry run (see below).
  3. If there are no diffs reported by the dry run you can rollup the change in a single PR, otherwise you need to open a standalone PR with the diff in the PR body and ask a review from the team lead. Example PR

Some teams might have a complex GitHub team structure that's not easily replicable in the team repo. In those cases ping me and I'll add proper support for those in the repo code.

Testing the changes locally

First of all clone both the rust-lang/team and rust-lang/rust-central-station repos.

To enable synchronization for a team the following snippet needs to be added to the team's file:

[github]
orgs = ["rust-lang"]

If the GitHub team name doesn't reflect the one in the repo, you can add the team-name key to the [github] section with the correct one. Also, if the team is also on the nursery you need to add that to the orgs list. Once the changes are done, you can check everything is good by running this command:

cargo run check

With the changes done to the team repository it's time to check what's the difference between the team repo and the GitHub teams. To do that, move in the rust-central-section repository, set the GITHUB_TOKEN environment variable to a valid GitHub personal access token (you need to be a member of the main and nursery orgs) and run this command:

cargo run --bin sync-github -- --team-repo /path/to/your/team/repo/checkout

The tool will output the differences between GitHub and the team repo, if present.

If there are any questions please let me know! cc @nellshamrell

nikomatsakis commented 5 years ago

Can we make some kind of checklist for the teams that still need to be synchronized here? That might help in working through the list.