Created
October 3, 2022 02:22
-
-
Save henryhchchc/fcef677ffa127289e7e0de618d907100 to your computer and use it in GitHub Desktop.
Automation script for accept all the repository invitation on GitHub
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/sh | |
API_KEY="$1" | |
[ -z $API_KEY ] && echo "Usage: \n\taccept-invitation.sh <API_KEY>" && exit 1 | |
INVITATION_IDS=$(curl -s -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $API_KEY" https://api.github.com/user/repository_invitations | jq -r ".[].id") | |
for id in $INVITATION_IDS; do | |
curl \ | |
-s \ | |
-X PATCH \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer $API_KEY" \ | |
"https://api.github.com/user/repository_invitations/$id" | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment