These scripts help manage GitHub organizations by automating tasks such as deleting teams, removing non-owner members, and transferring repositories between organizations.
These requirements must be met before using any of the scripts:
-
GitHub CLI (
gh) must be installed and available in yourPATH. -
A valid GitHub personal access token (PAT) with the following permissions:
repo(for private repositories)admin:org(to transfer repositories between organizations or manage teams)
-
The token must be exported as an environment variable:
export GITHUB_TOKEN=your_token_here
Deletes all teams in a given organization.
Usage:
./delete-all-teams.sh --org ORG [--confirm]Example:
./delete-all-teams.sh --org curio-studentenBy default, it only lists the teams it will delete. Double-check this list before proceeding. Use --confirm to actually delete them.
Removes all non-owner members (role != admin) from a given organization.
Usage:
./delete-non-owners.sh --org ORG [--confirm]Example:
./delete-non-owners.sh --org curio-studentenBy default, it only lists non-owner members it will remove. Double-check this list before proceeding. Use --confirm to actually remove them.
Moves all repositories in a source organization whose names start with a given prefix to a destination organization.
Usage:
./transfer.sh --src SRC_ORG --dst DST_ORG --prefix PREFIX [--confirm]Example (preview only):
./transfer.sh --src curio-lesmateriaal --dst curio-studenten --prefix pra-b3Example (execute transfer):
./transfer.sh --src curio-lesmateriaal --dst curio-studenten --prefix pra-b3 --confirmIf you get a gh: Validation Failed (HTTP 422) error during transfer it likely means the target org has insufficient collaborator seats. Add the collaborators to the destination org or remove them from the source repo before transferring.