gh-manage-invites
Manage invites to GH organizations in bulk.
Why?
While this is useful for many, many reasons, the driving pupose was to be used with
JupyterHub. Particularly, when using OAuthenticator
to allow users to authenticate to your JupyterHub via GitHub, you might want to allow only
users from a specific team or github organization to login. But inviting many users with
the GitHub web ui can be cumbersome, hence this commandline tool.
While this is not an official 2i2c project, it was inspired by this specific
request by
@erinmr.
Installation
You need a recent enough version of nodejs installed first.
After that, the recommended way to use this is via the npx
mechanism. It'll automatically install the package if needed.
$ npx gh-managed-invites
Usage: index [options] [command]
Manage bulk invitations to GitHub Organizations
Options:
-h, --help display help for command
Commands:
invite [options] <organization> <usernames...> Invite users to an organization
list-pending-invites <organization> List unaccepted invitations for a given organization
help [command] display help for command
Usage
Create a GitHub Personal Access Token
This tool will perform actions as you on GitHub, and so you need to create a
GitHub Personal Access Token
-
Go to Personal Access Tokens (classic). I have not
tested this with 'fine grained tokens' yet, so we would need to use classic tokens.
-
Click "Generate New Token" and then select "Generate New Token (classic)" from the dropdown.
-
Give it a descriptive name, and select an appropriate expiry date. If you are planning on doing
just a single round of mass invitations, I recommend selecting the smallest validity time
possible (7 days). Having these tokens lying around can be dangerous.
-
Select the admin:org
privilege, so the token can create invitations to the organizations you
are an admin of.
-
Click "Generate Token"
-
The token will be visible only this time - after you navigate away from this page, the token
will no longer be visible!
-
Specify it as an environment variable in your terminal
export GITHUB_TOKEN=<token>
Now you're all set up to use this tool!
Inviting many users to an organization
But... why JavaScript?
Most of the JupyterHub ecosystem tooling is in python, why is this written in Javascript?
As a child, I started writing code that others found useful 'for fun'. As an
adult, I'm very privileged to be able to write code for causes I care about, in
community with people who treat me well, and get paid for it! This is awesome!
In therapy, we have discovered it is still quite important to do things
'just for fun'. Writing code that's not actually useful to anyone doesn't feel like 'fun'
to me, but I also wanted to experience the feeling of 'hey, something new!'. Hence, am trying
out writing things that people will find useful in languages other than python, purely for fun.
Let's see how this goes.
Oh, and this is also why this project is licensed under the AGPL.
Given the commandline nature of this project, it should have 0 actual impact on any users. But maybe
the newness of it will give me a dopamine hit!