forked from fossasia/star-me
-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathscript.py
39 lines (28 loc) · 1.34 KB
/
script.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import subprocess
import json
try:
repository_list_fetch = subprocess.getstatusoutput(f'gh api -H "Accept: application/vnd.github+json" /orgs/amfoss/repos')
repository_list = json.loads(repository_list_fetch[1])
amFOSS_repos = []
for i in repository_list:
amFOSS_repos.append(i['name'])
print("\n")
for repo in amFOSS_repos:
stringS=f'gh api --method PUT -H "Accept: application/vnd.github+json" /user/starred/amfoss/{repo}'
print(f"Starring amfoss/{repo}")
subprocess.getstatusoutput(stringS)
userData = subprocess.getstatusoutput(f'gh api -H "Accept: application/vnd.github+json" /user')
user=json.loads(userData[1])
userName=user['name']
userLogin=user['login']
print(f'''
Thank you {userName} (@{userLogin}) for starring all the amFOSS repositories.
____ _ _ ____
/ ___|| |_ __ _ _ __ _ __(_)_ __ __ _ | _ \ ___ _ __ ___
\___ \| __/ _` | '__| '__| | '_ \ / _` | | | | |/ _ \| '_ \ / _ \\
___) | || (_| | | | | | | | | | (_| | | |_| | (_) | | | | __/
|____/ \__\__,_|_| |_| |_|_| |_|\__, | |____/ \___/|_| |_|\___|
|___/
''')
except Exception as e:
print("Unkown Error occured, please try again later")