Last active
June 5, 2019 09:17
-
-
Save tsub/a08f5ae493cdc221f50e1d5acd8ce126 to your computer and use it in GitHub Desktop.
自分のリポジトリをまとめて watch するやつ
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 | |
PAGE=$1 | |
SUBSCRIPTION_URLS=$(curl -s -H "Authorization: Bearer $GITHUB_API_TOKEN" "https://api.github.com/user/repos?affiliation=owner&page=$PAGE&per_page=100" | jq -r '.[] | select(.fork == false) | .subscription_url') | |
for url in $SUBSCRIPTION_URLS; do | |
RESPONSE=$(curl -s -H "Authorization: Bearer $GITHUB_API_TOKEN" "$url" | jq -r '.url') | |
if [ "$RESPONSE" = "null" ]; then | |
curl -s -H "Authorization: Bearer $GITHUB_API_TOKEN" -X PUT -d '{"subscribed":true}' "$url" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment