Created
May 23, 2024 18:19
-
-
Save vagelim/08824ead6e6ba7636641b89544ef81c5 to your computer and use it in GitHub Desktop.
add team to all repos in a github org
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export ORG=<organization-name> | |
export PERMISSION=<admin|push|pull> | |
export TEAM_SLUG=<team-name-in-url> | |
gh repo list ${ORG} --limit 1000 | awk '{print $1}' | while read -r OWNED_REPO | |
do | |
gh api --method PUT \ | |
-H "Accept: application/vnd.github.v3.repository+json" -H "X-GitHub-Api-Version: 2022-11-28" \ | |
/orgs/${ORG}/teams/${TEAM_SLUG}/repos/${OWNED_REPO} -f permission=${PERMISSION} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment