Skip to content

Instantly share code, notes, and snippets.

@dataflake
Created March 24, 2023 08:46
Show Gist options
  • Save dataflake/f33932efa8fa6423ff2907708664f936 to your computer and use it in GitHub Desktop.
Save dataflake/f33932efa8fa6423ff2907708664f936 to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# addreleasemanagers.sh Add Release Manager to all active repos
#
# Uses the "gh" CLI client (https://github.com/cli/cli),
# the GitHub REST API
# (https://docs.github.com/en/rest?apiVersion=2022-11-28)
# and the "jq" JSON processor (https://stedolan.github.io/jq/) via the
# "gh" flag "-q"
#
echo "Adding Release Manager team to repositories"
for REPO in $(gh repo list zopefoundation -L 400 --no-archived --json name -q '.[] | .name' | sort); do
echo " - ${REPO}"
gh api --method PUT -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /orgs/zopefoundation/teams/release-managers/repos/zopefoundation/${REPO} -f permission='maintain'
sleep 2
done
echo "Finished adding Release Manager team to repositories"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment