Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

automate skill label in skills.json #122

Merged
merged 15 commits into from
Mar 13, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions sync_community_skills/Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"

[packages]
requests = "*"
TimidRobot marked this conversation as resolved.
Show resolved Hide resolved

[dev-packages]
TimidRobot marked this conversation as resolved.
Show resolved Hide resolved

[requires]
python_version = "3.8"
TimidRobot marked this conversation as resolved.
Show resolved Hide resolved
57 changes: 57 additions & 0 deletions sync_community_skills/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions sync_community_skills/get_community_skills.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
"""
TimidRobot marked this conversation as resolved.
Show resolved Hide resolved
This script gets the data from the Github API to get the names and
languages of all the repositories of the 'Creative Commons' organization
and generate the required skills.json
"""

# Standard Lib
import json


# Third Part
import requests


def generate_databag():
"""
This method pulls the names and languages from the 'Github Api'
and loads them into the databag after a little formatting and
then this databag will be used to generate the required skills.json
The databag schema is down below:
databag schema
{
"name": "$",
"languages": []
}
"""
print("Pulling from the Github API")
result = []
api_request = requests.get('https://api.github.com/orgs/creativecommons/repos?per_page=100')
data = api_request.json()
for x in data:
databag = {"name": "", "languages": []}
databag['name'] = x['name']
result.append(databag)
languages_dat_from_api = requests.get(x['languages_url'])
databag['languages'].append(languages_dat_from_api.json())
return result


"""
Writing the result array into skills.json file
"""

with open('skills.json', 'w') as outfile:
json.dump(generate_databag(), outfile)
1 change: 1 addition & 0 deletions sync_community_skills/skills.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"name": "team-open", "languages": [{}]}, {"name": "cc.engine", "languages": [{"HTML": 263016, "Python": 158800}]}, {"name": "cc.licenserdf", "languages": [{"Python": 36857, "HTML": 14137, "Shell": 2438, "Makefile": 724}]}, {"name": "cc.license", "languages": [{"Python": 172412, "HTML": 1742}]}, {"name": "ccrel", "languages": [{"HTML": 107067, "CSS": 1077}]}, {"name": "ccrel-guide", "languages": [{"HTML": 51299, "CSS": 2359}]}, {"name": "cc.i18n", "languages": [{"Python": 47535, "Shell": 3480}]}, {"name": "search", "languages": [{"CSS": 285673, "PHP": 89717, "JavaScript": 41169, "Python": 2104, "Makefile": 1403, "Hack": 1178}]}, {"name": "licensebuttons", "languages": [{"Python": 14905, "HTML": 6703, "CSS": 380}]}, {"name": "creativecommons.org", "languages": [{"HTML": 24252938, "JavaScript": 3618481, "CSS": 281880, "Python": 36391, "Tcl": 34365, "Shell": 9122}]}, {"name": "rdfadict", "languages": [{"Python": 18574}]}, {"name": "cc.api", "languages": [{"Python": 81080}]}, {"name": "open4us.org", "languages": [{"PHP": 111720, "CSS": 91654, "Shell": 3591, "JavaScript": 1713}]}, {"name": "cc-resource-archive", "languages": [{}]}, {"name": "openpolicynetwork.org", "languages": [{"PHP": 344900, "JavaScript": 343234, "CSS": 99775, "Shell": 4061}]}, {"name": "wp-plugin-creativecommons", "languages": [{"PHP": 68157, "JavaScript": 38053, "CSS": 5816, "Shell": 2901, "SCSS": 2801}]}, {"name": "CCID-cas", "languages": [{"HTML": 13414, "PHP": 11000, "Hack": 6643, "TSQL": 3239, "CSS": 2491, "Ruby": 2276, "Shell": 1413}]}, {"name": "magical-pony", "languages": [{"HTML": 37711, "Shell": 7933}]}, {"name": "labs", "languages": [{}]}, {"name": "taaccct", "languages": [{"JavaScript": 45605, "CSS": 25053, "HTML": 22910, "PHP": 1117}]}, {"name": "creativecommons.github.io", "languages": [{"HTML": 12267926, "CSS": 301062, "Logos": 14933}]}, {"name": "cc-wp-theme", "languages": [{"Hack": 583837, "CSS": 78573, "PHP": 57818, "JavaScript": 10922, "HTML": 3418, "Makefile": 1555}]}, {"name": "rubycas-client-rails", "languages": [{"Ruby": 19921}]}, {"name": "cc-license-chooser", "languages": [{"XSLT": 450631, "JavaScript": 97291, "Python": 54030, "Emacs Lisp": 51707, "Makefile": 51285, "NewLisp": 49068, "Slash": 49019, "MAXScript": 48806, "C#": 48772, "SystemVerilog": 48696, "Hy": 48664, "Raku": 48622, "Smalltalk": 43545, "HTML": 28036, "PHP": 7217, "CSS": 4100, "Shell": 186}]}, {"name": "termination-of-transfer", "languages": [{"JavaScript": 56502, "PHP": 7735, "Smarty": 2205, "Shell": 511}]}, {"name": "mp", "languages": [{"HTML": 207642, "PHP": 54448, "CSS": 1457, "Makefile": 1166, "JavaScript": 205, "Shell": 191}]}, {"name": "faq", "languages": [{"HTML": 485386, "Shell": 931}]}, {"name": "new-www-theme", "languages": [{"SCSS": 114776, "PHP": 61743, "JavaScript": 13153, "HTML": 10405, "CSS": 401}]}, {"name": "new-www-plugin", "languages": [{"PHP": 81706, "JavaScript": 16611, "CSS": 488}]}, {"name": "new-creativecommons.org", "languages": [{"PHP": 4700119, "JavaScript": 4077737, "CSS": 633166, "HTML": 35320, "Tcl": 34365, "Shell": 1468}]}, {"name": "certificates-themes-plugins", "languages": [{"CSS": 186192, "PHP": 105176}]}, {"name": "scholars-addenda", "languages": [{"Python": 85211, "HTML": 13720, "JavaScript": 6467, "CSS": 2734}]}, {"name": "global-network-strategy", "languages": [{}]}, {"name": "commoners", "languages": [{"PHP": 1757870, "CSS": 437183, "JavaScript": 292646, "SCSS": 194799, "Shell": 21175, "HTML": 15226}]}, {"name": "cccatalog", "languages": [{"Python": 819674, "PLpgSQL": 3336, "Dockerfile": 1362, "Shell": 980}]}, {"name": "network-platforms", "languages": [{}]}, {"name": "reversionary-rights", "languages": [{"HTML": 14434, "Ruby": 7912, "CSS": 7483, "Shell": 1250}]}, {"name": "certificates-landing-page-theme", "languages": [{"CSS": 114485, "PHP": 52678, "JavaScript": 12461, "HTML": 10405}]}, {"name": "cccatalog-api", "languages": [{"Python": 380140, "HTML": 31818, "Shell": 4229, "Dockerfile": 2036, "Mako": 494}]}, {"name": "cccatalog-dataviz", "languages": [{"HTML": 49281, "JavaScript": 43024, "Python": 31089, "CSS": 15770, "Shell": 1030, "Dockerfile": 689}]}, {"name": "legaldb", "languages": [{"HTML": 43398, "Python": 38779, "SCSS": 5865, "JavaScript": 891}]}, {"name": "candela-utility", "languages": [{"PHP": 187019, "CSS": 137601, "JavaScript": 64545, "Shell": 3920, "Ruby": 413, "Hack": 92}]}, {"name": "australian-chapter", "languages": [{"PostScript": 727606}]}, {"name": "cccatalog-frontend", "languages": [{"Vue": 158797, "JavaScript": 153783, "SCSS": 3121, "Dockerfile": 505, "HTML": 150}]}, {"name": "sre-salt-prime", "languages": [{"SaltStack": 229250, "Shell": 24961, "Python": 14844, "Pug": 7392, "PHP": 3998, "Scheme": 3299, "JavaScript": 2951, "CSS": 288, "HTML": 238}]}, {"name": "cc-usability-prototypes", "languages": [{}]}, {"name": "creativecommons.github.io-source", "languages": [{"HTML": 58940, "JavaScript": 15227, "SCSS": 14358, "Python": 3534}]}, {"name": "wp-theme-cc-chapter", "languages": [{"PHP": 432837, "CSS": 329326, "SCSS": 199023, "HTML": 15444, "JavaScript": 13242}]}, {"name": ".github", "languages": [{}]}, {"name": "wp-theme-cctoolkit", "languages": [{"PHP": 20308, "CSS": 8076}]}, {"name": "queulat", "languages": [{"PHP": 141138, "JavaScript": 10407, "CSS": 1380, "HTML": 1335}]}, {"name": "wp-theme-cc-sotc", "languages": [{"CSS": 154749, "PHP": 101953, "SCSS": 47115, "HTML": 7613, "JavaScript": 6780}]}, {"name": "CCID-MediaWiki", "languages": [{"PHP": 4983}]}, {"name": "chooser", "languages": [{"JavaScript": 108369, "Vue": 107019, "HTML": 1796, "SCSS": 919, "Shell": 55}]}, {"name": "ccsearch-browser-extension", "languages": [{"JavaScript": 107355, "HTML": 52649, "SCSS": 12777}]}, {"name": "cc-link-checker", "languages": [{"Python": 63483}]}, {"name": "sre-wp-pull", "languages": [{"Shell": 12183}]}, {"name": "wp-theme-summit", "languages": [{"PHP": 4554, "SCSS": 805, "JavaScript": 701, "CSS": 406}]}, {"name": "vocabulary", "languages": [{"message": "API rate limit exceeded for 122.173.170.26. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)", "documentation_url": "https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting"}]}, {"name": "creativecommons-base", "languages": [{"message": "API rate limit exceeded for 122.173.170.26. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)", "documentation_url": "https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting"}]}, {"name": "ccos-scripts", "languages": [{"message": "API rate limit exceeded for 122.173.170.26. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)", "documentation_url": "https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting"}]}, {"name": "wp-theme-creativecommons.org", "languages": [{"message": "API rate limit exceeded for 122.173.170.26. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)", "documentation_url": "https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting"}]}, {"name": "image-crawler", "languages": [{"message": "API rate limit exceeded for 122.173.170.26. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)", "documentation_url": "https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting"}]}, {"name": "cc-licenses", "languages": [{"message": "API rate limit exceeded for 122.173.170.26. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)", "documentation_url": "https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting"}]}, {"name": "creativecommons-certificate", "languages": [{"message": "API rate limit exceeded for 122.173.170.26. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)", "documentation_url": "https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting"}]}, {"name": "primary-site-includes", "languages": [{"message": "API rate limit exceeded for 122.173.170.26. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)", "documentation_url": "https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting"}]}, {"name": "og-image-generator", "languages": [{"message": "API rate limit exceeded for 122.173.170.26. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)", "documentation_url": "https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting"}]}, {"name": "wp-theme-openglam", "languages": [{"message": "API rate limit exceeded for 122.173.170.26. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)", "documentation_url": "https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting"}]}, {"name": "cc-licenses-data", "languages": [{"message": "API rate limit exceeded for 122.173.170.26. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)", "documentation_url": "https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting"}]}, {"name": "wp-plugin-vocabulary-blocks", "languages": [{"message": "API rate limit exceeded for 122.173.170.26. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)", "documentation_url": "https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting"}]}, {"name": "wp-theme-cc-commoners", "languages": [{"message": "API rate limit exceeded for 122.173.170.26. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)", "documentation_url": "https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting"}]}, {"name": "wp-plugin-cc-global-network", "languages": [{"message": "API rate limit exceeded for 122.173.170.26. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)", "documentation_url": "https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting"}]}, {"name": "data-science-playground", "languages": [{"message": "API rate limit exceeded for 122.173.170.26. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)", "documentation_url": "https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting"}]}]
TimidRobot marked this conversation as resolved.
Show resolved Hide resolved