How to unstar all your github stars with API
visit here: https://github.com/settings/tokens
make sure to check repo
scope, it is needed to unstar
set apikey as env variable
export APIKEY=xxxxxxxxx
first get total number of pages of your star
curl -I -H "Authorization: token $APIKEY" https://api.github.com/user/starred
HTTP/1.1 200 OK
...
Link: <https://api.github.com/user/starred?page=2>; rel="next", <https://api.github.com/user/starred?page=4>; rel="last"
...
then iterate on all pages (1 to 4)
for p in `seq 1 4`;do
echo page
curl -s -H "Authorization: token $APIKEY" https://api.github.com/user/starred\?page\=$p | jq -r '.[] |.full_name' >>stars.txt
done
finally delete all repos in the stars.txt
file
while read REPO;do
echo
curl -X DELETE -s -H "Authorization: token $APIKEY" "https://api.github.com/user/starred/$REPO"
sleep 0.5
done<stars.txt