Skip to content

jamesjuett/github-invites

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Github Organization Invites

This script uses the Github API to create invitations to a Github organization (e.g. "eecs280staff") and a single team (e.g. "Course Staff"). Users to invite are specified by a list of emails in a JSON file (any users that are already a member of the organization will be ignored).

Getting Started

Ensure you have node installed:

sudo apt update
sudo apt install nodejs

OR

brew install nodejs

If you already have node, make sure you have a somewhat recent version:

node --version

From the base directory of this repo, install dependencies using npm:

npm install

A post-install script will create template .env and emails.json files.

Github Configuration

Edit the .env file. Make sure spaces are escaped or enclosed in quotes. For example:

GITHUB_TOKEN=your_github_token_here
ORGANIZATION_NAME=eecs280staff
TEAM_NAME="Course Staff"

Consider generating a new token with a short lifetime for this purpose. See https://github.com/settings/tokens. Either a fine-grained token with Administration privileges or a classic token with admin:org scope will work. Using an existing, long-lived token is not recommended.

Email List

Edit the emails.json file to include the list of emails to invite. For example:

[
  "uniqname1@umich.edu",
  "uniqname2@umich.edu",
  "uniqname3@umich.edu"
]

The script checks if a user is already a member of the organization before sending an invite, so it's fine to include emails that may already be members.

Running the Script

Double check your configuration in .env and emails.json, then run:

npx tsx invite-users.ts

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published