@@ -15,6 +15,7 @@ def rewriteContents(old_content, new_content):
1515git = Github (sys .argv [1 ])
1616start = git .rate_limiting [0 ]
1717max_repo_description = int (sys .argv [4 ])
18+ allow_forks = bool (sys .argv [5 ])
1819print (f'Request left at start of the script: { start } ' )
1920
2021user_object = git .get_user ()
@@ -33,7 +34,8 @@ def rewriteContents(old_content, new_content):
3334 if 'project' in repo_topics :
3435 project_data [f'{ repo } ' ] = {'repo_description' : repo_object .description if len (repo_object .description ) < max_repo_description else repo_object .description [:max_repo_description ] + '...' ,
3536 'repo_stars' : int (repo_object .stargazers_count ),
36- 'repo_link' : f'https://github.com/{ git_username } /{ repo } '
37+ 'repo_link' : f'https://github.com/{ git_username } /{ repo } ' ,
38+ 'repo_forks' : int (repo_object .forks_count )
3739 }
3840
3941 else :
@@ -62,10 +64,14 @@ def rewriteContents(old_content, new_content):
6264contents = readmeRepo .get_contents (f'{ sys .argv [2 ]} ' )
6365
6466newContent = []
65- for project , project_detail in project_data_sorted .items ():
66- newContent .append (
67- f'\n * [{ project } ]({ project_detail ["repo_link" ]} ) { project_detail ["repo_stars" ]} ⭐ ({ project_detail ["repo_description" ]} )' )
68-
67+ if allow_forks :
68+ for project , project_detail in project_data_sorted .items ():
69+ newContent .append (
70+ f'\n * [{ project } ]({ project_detail ["repo_link" ]} ) { project_detail ["repo_stars" ]} ⭐, { project_detail ["repo_forks" ]} 🍴 ({ project_detail ["repo_description" ]} )' )
71+ else :
72+ for project , project_detail in project_data_sorted .items ():
73+ newContent .append (
74+ f'\n * [{ project } ]({ project_detail ["repo_link" ]} ) { project_detail ["repo_stars" ]} ⭐ ({ project_detail ["repo_description" ]} )' )
6975
7076newContent = ' ' .join (newContent )
7177rewrittenReadme = rewriteContents (readme , newContent )
0 commit comments