Code Monkey home page Code Monkey logo

github-teams-user-sync's Introduction

group-to-teams-sync-bot

Billiam the Octocat helping folks get into teams.

Groups (currently Azure Active Directory Only) to GitHub Teams sync

CodeQL Docker Pulls CodeFactor

Before submitting a new Feature request, please check existing open and closed Issues

Static Badge

Important Commands

# Run the application in "dev" mode and watch for changes
npm run dev
# Generate models from the openapi definition
npm run openapi

Application Configuration

๐Ÿšง Coming soon...

Per-Organization Configuration

See ./docs/OrganizationConfiguration.md for further details!

Running the sync bot

See ./docs/RunningTheApp.md for further details!

github-teams-user-sync's People

Contributors

dependabot[bot] avatar joshuathemiller avatar

Stargazers

 avatar

Watchers

 avatar

github-teams-user-sync's Issues

Grant access to repos from teams

While other bots do this already (i.e., SafeSettings), it would be beneficial for this bot to include such functionality as well. After all, users of this bot may not be using others and assigning teams access to repositories falls under the purview of "syncing teams."

Decision Points

  • Repo name property- should it just be Name, or Name and NamePattern?
    • Leaving it as "Name" makes consumption easier though increases development. Most likely that is worth it- make the consumer experience great.

Schema Options

Teams:
- Name: Some_Team
  Repos:
# Pattern matching can be done, though specific technique must be chosen and documented.
  - NamePattern: SomeName-*
    Permission: Write
  - Name: SomeSpecificRepo
    Permission: Admin

"Display Name" or similar

OrganizationMembersGroup: my_org_git_users
GitHubTeams:
  - name: Team A
    group: AZU_SOME_TEAM_USERS
  - name: CloudEnablement
    group: AZU_CE_ADMINS

Some way to make the name of the Team that is beings synced different than the group it's syncing to. This also facilitates more Team-scoped metadata later.

Allow discovery of teams configuration files in subfolders

Why allow this? To leverage CODEOWNERS as a means to delegate trust for team creation

Enterprise Features

Some mechanism should be added to this app to support for enabling/disabling Enterprise features.

  • Perhaps a flag at the App level- IsEnterprise:boolean.
  • False by default (to minimize setup by non-enterprises).
  • Enables/disables registration of Enterprise specific endpoints (i.e., list Orgs in Enterprise)

Trigger various cache affecting calls asyncronously

Many calls are cached for two reasons:

  1. To mitigate bumping into the GitHub API rate limit
  2. To make this application feel "snappier" since some calls can be very time consuming for larger orgs.

This isn't necessarily a v1 requirement, but certain calls (i.e., listing members of an org) NEED to be ran in the background on some set cadence (even when this hooks into GitHub events- we need to validate at some point that no event was missed, after all).

Teams to Ignore

Admins and Organizations should be able to provide a list of Team Names that should never be synced by this bot. There have been reported cases where such Teams were communicated out to their coworkers, but folks were still adding said Teams.

This is mainly problematic when the underlying groups may contain many, many, thousands of users. However, in all cases that I've heard of, it isn't the size of the team that is the problem... it's moreso that the large team simply shouldn't be used via this bot.

One issue that is present with large teams- due to API rate limits, this bot WILL run into issues syncing large teams (>1000 users).

Manage Copilot License teams

A valuable feature for this bot to add is the ability to manage Copilot teams: https://docs.github.com/en/rest/copilot/copilot-business?apiVersion=2022-11-28#add-teams-to-the-copilot-business-subscription-for-an-organization

Note that this functionality should be marked as Beta and/or should include extra wrappers in case of failures- failure to set this due to API changes should not cause the whole bot to fail.

Schema Options

I'm leaning towards Option 2 as it promotes the reuse of an existing team for granting Copilot Access while still granting the flexibility of having a designated team for Copilot access. With the top level property of Option 1, reuse for general repo access would not be possible.

The bot could support both concepts, though that may cause undue confusion ๐Ÿค” for now I am in favor of choosing one or the other.

Option 1 - New top-level property

OrganizationOwnersGroup: Some_Org_Owner_Group
OrganizationMembersGroup: Some_Group_To_Sync_For_Organization_Membership
GitHubTeamNames:
- Some_Team_To_Sync
AdditionalSecurityManagerGroups:
- Name: Some_SecurityManager_Team
- Name: Some_SecurityManager_Team_2
  DisplayName: Some Security Manager Team 2
# A new top level property
CopilotLicenseTeams:
- Name: Some_Copilot_Team
- Name: Some_Copilot_Team_2
  DisplayName: Some Copilot Team 2
Teams:
- Name: Some_Team
- Name: Some_Team_2
  DisplayName: Some Team 2

Option 2 - New property on Teams

OrganizationOwnersGroup: Some_Org_Owner_Group
OrganizationMembersGroup: Some_Group_To_Sync_For_Organization_Membership
GitHubTeamNames:
- Some_Team_To_Sync
AdditionalSecurityManagerGroups:
- Name: Some_SecurityManager_Team
- Name: Some_SecurityManager_Team_2
  DisplayName: Some Security Manager Team 2
Teams:
- Name: Some_Team
- Name: Some_Team_2
  DisplayName: Some Team 2
- Name: Some_Team_3
  DisplayName: Some Team 3
# A new property on individual Teams
  CopilotEnabled: true

Please sir, can I have some docs?

What would I need to change/update to leverage this in a new GHEC Enterprise against a new LDAP environment?


  • Development requirements
  • Running app locally
  • Debugging tips and tricks
  • Running app in production (this should cover the question above)

Feature Suggestion: Org Owners

It would be great to have the functionality to denote a group of people as the org owners. It would save a lot of manual effort as we add additional org owners to our larger orgs.

For this to work properly, we wouldn't want to remove org owner rights if they fall out of the existing group. That would put us at risk of having an unmanageable org if we have a sync failure. I would prefer removing org owners manually when needed.

Enable cancelling of inflight Invitations

The sync bot should be able to cancel in-flight invitations in the case where a GitHub User has joined the Organization Member group after getting access to an individual team.

This will help resolve an issue some users are facing- where they are never added to GitHub Teams due to an existing Org Member Invitation being present.

Enhance logging

For my own sanity, the bot must output additional details when performing operations. For example,

  • Any time the bot is trying to add a user to the team, if the user doesn't exist and/or is "dormant" the sync bot must clearly state so. At this point in time, the bot does output users with Issues... However, additional clarity could be had by clearing separating/categorizing what "type" of issues are found with the user. More thoughts are needed on this.
  • If an Org has not granted the app the proper permissions, some operations will fail. The logs must clearly call attention to the fact that the bot does not have permissions, and that folks must poke the Org Owners to update said permissions (by requesting the updated permissions request from the bot).

List Orgs in Enterprise

This feature will only be useful for Enterprise customers.

Requires the following Issue to be completed first: #59

Allow teams to be used as membership groups

While the OrganizationMembersGroup exists to control Org Membership, there has been an increase in asks to allow for individual teams to simply grant an assumption of Membership. As one of the tenets of a good app (in my opinion) is to not make assumptions on others behalf, I am opening this Issue to catalog my thoughts on a potential solution (in addition to recording this ask).

Solution Idea

A new boolean property: AssumeMembershipViaTeams.

By default, this will remain false and optional. Organization's may choose to set this to true. Doing so should cause the app to skip Organization Membership checks for individuals as the assumption as set via this property will be that any member of a team should be a member of the Org.

Risk

This may complicate a future enhancement around the ability to remove Org Members, but with proper segregation of components this should not prove too difficult to implement.

Ability to add child teams

As title says ๐Ÿ™‚

It would be advantageous if this bot could support nesting Teams.

The team sync yaml could be enhanced to support something like the following:

# This property is used to control the addition of general Members to your Organization.
OrganizationMembersGroup: Some_Group_To_Sync_For_Organization_Membership
# This property is used for syncing all other GitHub Teams. Please note that users must also be a part of the `OrganizationMembersGroup` for the synchronization of the teams below to function properly.
GitHubTeamNames:
- Team: Some_Team_To_Sync
  FollowChildren: true 
- Team: Some_Other_Team_To_Sync
  Children:
  - Team: Some_Child_Team_To_Sync
    Children:  Some_Child_Team_To_Sync
  - Some_Other_Child_Team_To_Sync

Create status check for PRs

On pr to default branch create a check suite and check run which will verify that the AD group already exists and fail if it doesn't.

Also emit some information in the check run result such as how many people will be added to the team once merged.

Tests

  • Choose testing tooling
  • Add tests

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.