Skip to content

Commit

Permalink
Update repositoryStared.py
Browse files Browse the repository at this point in the history
  • Loading branch information
varunsridharan committed Jan 28, 2023
1 parent a8730f5 commit c4ad508
Showing 1 changed file with 34 additions and 38 deletions.
72 changes: 34 additions & 38 deletions src/repositoryStared.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,50 +26,46 @@ def repositoryStared():



try:
if isBlacklistedRepository(repo.full_name):
print(" ---> Warning : Repository Matches Blacklist")
continue

if real_repo in repo_map:
gitea_dest_user = repo_map[real_repo]
if isBlacklistedRepository(repo.full_name):
print(" ---> Warning : Repository Matches Blacklist")
continue

gitea_uid = giteaGetUser(gitea_dest_user)
if real_repo in repo_map:
gitea_dest_user = repo_map[real_repo]

if gitea_uid == 'failed':
gitea_uid = giteaCreateUserOrOrg(gitea_dest_user,repo.owner.type)
gitea_uid = giteaGetUser(gitea_dest_user)

repo_name = "{0}".format(real_repo)
if gitea_uid == 'failed':
gitea_uid = giteaCreateUserOrOrg(gitea_dest_user,repo.owner.type)

m = {
"repo_name" : repo_name,
"description" : (repo.description or "not really known")[:255],
"clone_addr" : repo.clone_url,
"mirror" : True,
"private" : repo.private,
"uid" : gitea_uid,
}
repo_name = "{0}".format(real_repo)

status = giteaCreateRepo(m,repo.private,True)
if status != 'failed':
try:
if status != 'exists':
giteaExistsRepos['{0}/{1}'.format(repo.owner.login,repo_name)] = "{0}/{1}".format(gitea_dest_user,repo_name)
topics = repo.get_topics()
topics.append('starred-repo')
topics.append('starred-{0}-repo'.format(repo_owner))
giteaSetRepoTopics(repo_owner,repo_name,topics)
giteaSetRepoStar(repo_owner,repo_name)
except GithubException as e:
print("###[error] ---> Github API Error Occured !")
print(e)
print(" ")
else:
log(repo)
except:
log("[error] Unknown Error Occured")
time.sleep(5)

m = {
"repo_name" : repo_name,
"description" : (repo.description or "not really known")[:255],
"clone_addr" : repo.clone_url,
"mirror" : True,
"private" : repo.private,
"uid" : gitea_uid,
}

status = giteaCreateRepo(m,repo.private,True)
if status != 'failed':
try:
if status != 'exists':
giteaExistsRepos['{0}/{1}'.format(repo.owner.login,repo_name)] = "{0}/{1}".format(gitea_dest_user,repo_name)
topics = repo.get_topics()
topics.append('starred-repo')
topics.append('starred-{0}-repo'.format(repo_owner))
giteaSetRepoTopics(repo_owner,repo_name,topics)
giteaSetRepoStar(repo_owner,repo_name)
except GithubException as e:
print("###[error] ---> Github API Error Occured !")
print(e)
print(" ")
else:
log(repo)

if loop_count % 50 == 0:
log(False)
Expand Down

0 comments on commit c4ad508

Please sign in to comment.