Skip to content

Instantly share code, notes, and snippets.

@tsub
Last active June 5, 2019 09:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsub/a08f5ae493cdc221f50e1d5acd8ce126 to your computer and use it in GitHub Desktop.
Save tsub/a08f5ae493cdc221f50e1d5acd8ce126 to your computer and use it in GitHub Desktop.
自分のリポジトリをまとめて watch するやつ
#!/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