Skip to content

Instantly share code, notes, and snippets.

@soda480
Last active May 19, 2021 16:06
Show Gist options
  • Select an option

  • Save soda480/a1d5cdf3f303a2625fd1e924a546ee76 to your computer and use it in GitHub Desktop.

Select an option

Save soda480/a1d5cdf3f303a2625fd1e924a546ee76 to your computer and use it in GitHub Desktop.
Get number of repositories by topic in an organization
python - << EOF
from github3api import GitHubAPI
client = GitHubAPI.get_client()
topics = [
'--topic-goes-here--',
'--topic-goes-here--',
'--topic-goes-here--'
]
org = '--organization-goes-here--'
for topic in topics:
result = client.get(f'/search/repositories?q=topic:{topic}+org:{org}')
print(f"{topic}:{result['total_count']}")
EOF
@soda480
Copy link
Author

soda480 commented May 19, 2021

The script above can be executed within a Docker container, like this:

export http_proxy=<--http-proxy-goes-here-->
export https_proxy=<--https-proxy-goes-here-->
export GH_TOKEN_PSW=<--your-github-token-goes-here-->

docker container run --rm -it -e http_proxy -e https_proxy -e GH_TOKEN_PSW python:3.9-alpine /bin/sh

pip install github3api

<--copy-and-paste-the-script-above-here-->

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment