Skip to content

Instantly share code, notes, and snippets.

@narze
Created October 6, 2022 16:31
Show Gist options
  • Save narze/c7a1ba4760899222288b960b1356ddc9 to your computer and use it in GitHub Desktop.
Save narze/c7a1ba4760899222288b960b1356ddc9 to your computer and use it in GitHub Desktop.
Add contributers to my Hacktoberfest repos
#!/bin/bash
USER="tinarskii"
REPOS=(
"narze/DaiMai"
"narze/awesome-cheab-quotes"
"narze/awesome-salim-quotes"
"narze/coffee-to-code"
"narze/dumb-questions-th"
"narze/nunmun"
"narze/react-useless"
"narze/torpleng"
"narze/deploydeemai.today"
)
for REPO in "${REPOS[@]}"; do
echo "Adding user ${USER} to $REPO"
# https://docs.github.com/en/rest/collaborators/collaborators#add-a-repository-collaborator
gh api \
--method PUT \
-H "Accept: application/vnd.github+json" \
"/repos/$REPO/collaborators/$USER" \
-f permission='push' && echo 'Added' || echo 'Failed'
echo "\n============================================================\n"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment