Last active
May 18, 2023 08:27
-
-
Save p3r7/e22de46608e4bdb01dd595c48336c132 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python3 | |
## ------------------------------------------------------------------------ | |
## imports | |
import re | |
import json | |
from pprint import pprint | |
import requests | |
## ------------------------------------------------------------------------ | |
## main | |
r = requests.get('https://raw.githubusercontent.com/monome/norns-community/main/community.json', headers={'Accept': 'application/json'}) | |
script_index = r.json() | |
scripts_not_on_main = [] | |
scripts_not_direct_github_links = [] | |
for script in script_index['entries']: | |
name = script['project_name'] | |
repo_url = script['project_url'] | |
if repo_url.endswith(".git"): | |
repo_url = repo_url[:-(len(".git"))] | |
parsed_repo_url = re.search('^https://github.com/([a-zA-Z\d\._-]*)/([a-zA-Z\d\._-]*)/?$', repo_url) | |
if not parsed_repo_url: | |
scripts_not_direct_github_links.append(name) | |
continue | |
user = parsed_repo_url.group(1) | |
project = parsed_repo_url.group(2) | |
# print('https://api.github.com/repos/' + user + '/' + project) | |
r2 = requests.get('https://api.github.com/repos/' + user + '/' + project) | |
repo_props = r2.json() | |
if repo_props['default_branch'] != 'main': | |
scripts_not_on_main.append(name) | |
print("not a standard github link: ") | |
pprint(scripts_not_direct_github_links) | |
print("not on a \"main\" branch: ") | |
pprint(scripts_not_on_main) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment