Last active
February 6, 2023 10:18
-
-
Save gitstua/9d95d4bbca1b98ed744b0f5dcb1ac67f to your computer and use it in GitHub Desktop.
This file contains 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
#!/bin/bash | |
## CAUTION: provided without warranty - use at own risk | |
# thanks https://gist.github.com/narze/2c2e141f03daea2c23fc5795107d41d4 | |
ORG="gitstua" | |
DISCUSSION_SETTING="true" | |
# Get repos | |
REPOS=($(gh repo list $ORG --limit 200 --json name --json owner -q '.[] | "\(.owner.login)/\(.name)"' | |
)) | |
for REPO in "${REPOS[@]}"; do | |
echo "Updated repo ${REPO} Org:$ORG to has_discussions:$DISCUSSION_SETTING" | |
#enable or disable discussions | |
gh api \ | |
--method PATCH \ | |
-H "Accept: application/vnd.github+json" \ | |
/repos/$REPO \ | |
-F has_discussions=$DISCUSSION_SETTING | |
echo "\n============================================================\n" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment