If you’ve ever had to add several users to a team in a GitHub organization, you know it can be a pain as it’s one user at a time and multiple clicks per add. This script aims to simplify that by adding users to a GitHub org team programmatically from a CSV file.
This script is in my github-misc-scripts repo:
Prerequisite: You need to make sure to have the
gh cli installed and authorized (
gh auth login).
- Create a
users.csvwith the list of users to add to the team, one per line, and leave a trailing empty line/whitespace at the end of the file. The file should look like:
1 2 3
- From there, it’s pretty simple - run the script, passing in the
users.csvfile, org name, and team name:
./add-users-to-team-from-list.sh users.csv <org> <team>
Hopefully this saves you some time in the UI when adding multiple users to a team!