@@ -25,10 +25,11 @@ def run(gx_context, gx_output, gh_api):
2525 else :
2626 gx_output .r_log (f'{ reponame_msg } ' , 'profiling' )
2727
28- stargazers_message = f"Stars count: [{ repository .get ('stargazers_count' )} ]"
29- if repository .get ('stargazers_count' , 0 ) > 0 :
30- stargazers_message += f" List at: { repository .get ('stargazers_url' )} "
31- gx_output .r_log (stargazers_message , rtype = "profiling" )
28+ if repository .get ('stargazers_count' ) is not None :
29+ stargazers_message = f"Stars count: [{ repository .get ('stargazers_count' )} ]"
30+ if repository .get ('stargazers_count' , 0 ) > 0 :
31+ stargazers_message += f" List at: { repository .get ('stargazers_url' )} "
32+ gx_output .r_log (stargazers_message , rtype = "profiling" )
3233
3334 if repository .get ('owner' ):
3435 gx_output .r_log (f"Repository owner account is [{ repository .get ('owner' ).get ('login' )} ]: { repository .get ('owner' ).get ('html_url' )} " , rtype = "profiling" )
@@ -348,10 +349,11 @@ def run(gx_context, gx_output, gh_api):
348349 print(f"Group length: {len(group)} - Group ID: {group_key}: Range {range_start} to {range_end}, Members: {len(group)}, Logins: {logins}")
349350 """
350351
351- watchers_message = f"Watchers count: [{ repository .get ('subscribers_count' )} ]"
352- if repository .get ('subscribers_count' , 0 ) > 0 :
353- watchers_message += f" List at: { repository .get ('subscribers_url' )} "
354- gx_output .r_log (watchers_message , rtype = "profiling" )
352+ if repository .get ('subscribers_count' ) is not None :
353+ watchers_message = f"Watchers count: [{ repository .get ('subscribers_count' )} ]"
354+ if repository .get ('subscribers_count' , 0 ) > 0 :
355+ watchers_message += f" List at: { repository .get ('subscribers_url' )} "
356+ gx_output .r_log (watchers_message , rtype = "profiling" )
355357
356358 if repository .get ('open_issues_count' , 0 ) > 0 :
357359 gx_output .r_log (f"Repository has { repository .get ('open_issues_count' )} Open Issues: { repository .get ('html_url' )} /issues" , rtype = "profiling" )
@@ -373,19 +375,21 @@ def run(gx_context, gx_output, gh_api):
373375 gx_output .r_log (f"The parent of this fork comes from SOURCE repo: { repository .get ('source' )['html_url' ]} " , rtype = "fork" )
374376
375377
376- days = (datetime .now (timezone .utc ) - gh_time .parse_date (repository .get ('created_at' , datetime .utcnow ().isoformat ()))).days
377- message = f"{ days } days old"
378- if days > 365 :
379- years = "{:.2f}" .format (days / 365 )
380- message = f"{ years } years old"
381- gx_output .r_log (f"Repository created: { repository .get ('created_at' )} , is { message } ." , rtype = "profiling" )
382-
383- days = (datetime .now (timezone .utc ) - gh_time .parse_date (repository .get ('updated_at' , datetime .utcnow ().isoformat ()))).days
384- message = f"{ days } days ago"
385- if days > 365 :
386- years = "{:.2f}" .format (days / 365 )
387- message = f"{ years } years ago"
388- gx_output .r_log (f"Repository last updated: { repository .get ('updated_at' )} , { message } ." , rtype = "profiling" )
378+ if repository .get ('created_at' ) is not None :
379+ days = (datetime .now (timezone .utc ) - gh_time .parse_date (repository .get ('created_at' , datetime .utcnow ().isoformat ()))).days
380+ message = f"{ days } days old"
381+ if days > 365 :
382+ years = "{:.2f}" .format (days / 365 )
383+ message = f"{ years } years old"
384+ gx_output .r_log (f"Repository created: { repository .get ('created_at' )} , is { message } ." , rtype = "profiling" )
385+
386+ if repository .get ('updated_at' ) is not None :
387+ days = (datetime .now (timezone .utc ) - gh_time .parse_date (repository .get ('updated_at' , datetime .utcnow ().isoformat ()))).days
388+ message = f"{ days } days ago"
389+ if days > 365 :
390+ years = "{:.2f}" .format (days / 365 )
391+ message = f"{ years } years ago"
392+ gx_output .r_log (f"Repository last updated: { repository .get ('updated_at' )} , { message } ." , rtype = "profiling" )
389393
390394 if repository .get ('archived' ) == True :
391395 gx_output .r_log (f"Repository is archived and therefore likely no longer maintained." , rtype = "profiling" )
0 commit comments