Skip to content

curio-team/github-tools

Repository files navigation

GitHub Tools

These scripts help manage GitHub organizations by automating tasks such as deleting teams, removing non-owner members, and transferring repositories between organizations.

Requirements

These requirements must be met before using any of the scripts:

  • GitHub CLI (gh) must be installed and available in your PATH.

  • 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

Scripts

Delete All Teams Script

Deletes all teams in a given organization.

Usage:

./delete-all-teams.sh --org ORG [--confirm]

Example:

./delete-all-teams.sh --org curio-studenten

By default, it only lists the teams it will delete. Double-check this list before proceeding. Use --confirm to actually delete them.

Delete All Non-Owner Members Script

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-studenten

By default, it only lists non-owner members it will remove. Double-check this list before proceeding. Use --confirm to actually remove them.

Repository Transfer Script

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-b3

Example (execute transfer):

./transfer.sh --src curio-lesmateriaal --dst curio-studenten --prefix pra-b3 --confirm

If 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.

About

Scripts for managing GitHub repositories

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages