Skip to content

user invites: add backend to query invitable users

Warren Gifford requested to merge sg/invite-collab-backend into main

Created by: slimsag

I am working on a feature that will let you invite collaborators to your repositories while you wait for repositories to clone on Sourcegraph:


image

In order to identify collaborators we can invite, we need to use GitHub's API (we can't use our own, because the repositories are not yet cloned.) I've added this to our GitHub v4 GraphQL client, and exposed the data over GraphQL via a new ExternalService.invitableCollaborators field.

I chose to use the GitHub API for enumerating committers (not the repository collaborator API) because:

  1. The collaborator API return's users public emails listed on their GitHub profile, which often aren't the ones e.g. your coworker would use at work and not the one you'd want to invite them via.
  2. It gives us "relevance": we can order by most-recent-committer with the idea being that those who commit code frequently are more likely to be the ones you'd want to invite (than, say, someone who committed code last year and left the org.)

To avoid imposing any additional load on our rate limits with the user's GitHub access token, we only query GitHub for 20 repositories out of those that you've chosen to add to Sourcegraph.

Merge request reports

Loading