wesley-dean-flexion / sync_github_org_team

Tool to manage a team consisting of all users in a GitHub organization
0 stars 0 forks source link

allow filtering on fields other than login #21

Closed wesley-dean-flexion closed 3 months ago

wesley-dean-flexion commented 3 months ago

As a GitHub team maintainer, so that I have more granular control over which organizational members are included on a given team, I would like to be able to filter on fields other than login.

wesley-dean-flexion commented 3 months ago

The login field represents an organizational member's username (e.g., wesley-dean-flexion). The GitHub API supports user objects which can be queried, updated, etc. via API call:

PUT /orgs/{org}/memberships/{user}

The user object GET documentation provides access to an abundance of additional fields:

{
  "login": "octocat",
  "id": 1,
  "node_id": "MDQ6VXNlcjE=",
  "avatar_url": "https://github.com/images/error/octocat_happy.gif",
  "gravatar_id": "",
  "url": "https://api.github.com/users/octocat",
  "html_url": "https://github.com/octocat",
  "followers_url": "https://api.github.com/users/octocat/followers",
  "following_url": "https://api.github.com/users/octocat/following{/other_user}",
  "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
  "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
  "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
  "organizations_url": "https://api.github.com/users/octocat/orgs",
  "repos_url": "https://api.github.com/users/octocat/repos",
  "events_url": "https://api.github.com/users/octocat/events{/privacy}",
  "received_events_url": "https://api.github.com/users/octocat/received_events",
  "type": "User",
  "site_admin": false,
  "name": "monalisa octocat",
  "company": "GitHub",
  "blog": "https://github.com/blog",
  "location": "San Francisco",
  "email": "octocat@github.com",
  "hireable": false,
  "bio": "There once was...",
  "twitter_username": "monatheoctocat",
  "public_repos": 2,
  "public_gists": 1,
  "followers": 20,
  "following": 0,
  "created_at": "2008-01-14T04:33:35Z",
  "updated_at": "2008-01-14T04:33:35Z"
}

Most of those fields aren't useful; perhaps email (e.g., match @flexion\.us$) might be interesting, but even that's questionable at this point.

Regardless, there may be some value in having access to those fields.

This is likely a lower-priority idea.