Home GitHub: Script to Bulk Add Users to a Team
Post
Cancel

GitHub: Script to Bulk Add Users to a Team

Overview

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.

Using the Script

Script link in my github-misc-scripts repo

0. Prerequisite: You need to make sure to have the gh cli installed and authorized (gh auth login).

1. Creates a users.csv with 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
user1
user2

2. From there, it’s pretty simple - run the script:

1
./add-users-to-team-from-list.sh users.csv <org> <team>

Summary

Hopefully this saves you some time in the UI when adding multiple users to a team!

This post is licensed under CC BY 4.0 by the author.

A Lap Around GitHub Advanced Security (30m Video)

Azure DevOps Commit Message Validator and PR Linker GitHub Action