Attention List #4

Closed
sgode wants to merge 16 commits from (deleted):attention_list into main
Showing only changes of commit 8c13133c60 - Show all commits

View File

@ -76,7 +76,7 @@ def get_args():
help='Git hoster to be queried for failed Pull Requests.\n'
'Default: [github, gitea].'
)
return(parser.parse_args())
return parser.parse_args()
def get_gitea_repos(url, headers, gitea_org):
repositories = []
@ -99,7 +99,7 @@ def get_gitea_repos(url, headers, gitea_org):
print("The request status is: " + str(res.status_code) +
" | " + str(res.reason))
break
return(repositories)
return repositories
def get_gitea_prs(url, headers, gitea_org, repo):
pullrequests = []
@ -116,7 +116,7 @@ def get_gitea_prs(url, headers, gitea_org, repo):
print("The request status is: " + str(res.status_code) +
" | " + str(res.reason))
exit()
return(pullrequests)
return pullrequests
Outdated
Review

you can either use existing SDK or at least make a wrapper for requests so that you do not repeat the same exception handling block over and over again (smth like in https://review.opendev.org/c/zuul/zuul/+/850008/10/zuul/driver/gitea/giteaconnection.py#364 or in https://github.com/opentelekomcloud/ansible-collection-gitcontrol/tree/main/plugins/module_utils)

you can either use existing SDK or at least make a wrapper for requests so that you do not repeat the same exception handling block over and over again (smth like in https://review.opendev.org/c/zuul/zuul/+/850008/10/zuul/driver/gitea/giteaconnection.py#364 or in https://github.com/opentelekomcloud/ansible-collection-gitcontrol/tree/main/plugins/module_utils)
def get_failed_gitea_commits(pull, url, gitea_org, repo, headers):
failed_commits = []
@ -142,7 +142,7 @@ def get_failed_gitea_commits(pull, url, gitea_org, repo, headers):
" | " + str(res_sta.reason))
print(json.dumps(res_sta.json()))
exit()
return(failed_commits)
return failed_commits
def get_github_repos(url, headers, gh_org):
repositories = []
@ -164,7 +164,7 @@ def get_github_repos(url, headers, gh_org):
print("The request status is: " + str(res.status_code) +
" | " + str(res.reason))
break
return(repositories)
return repositories
def get_github_prs(url, headers, gh_org, repo):
pullrequests = []
@ -187,7 +187,7 @@ def get_github_prs(url, headers, gh_org, repo):
print("The request status is: " + str(res.status_code) +
" | " + str(res.reason))
break
return(pullrequests)
return pullrequests
def get_failed_gh_commits(pull, url, gh_org, repo, headers):
failed_commits = []
@ -226,13 +226,10 @@ def get_failed_gh_commits(pull, url, gh_org, repo, headers):
" | " + str(res_sta.reason))
print(json.dumps(res_sta.json()))
exit()
return(failed_commits)
return failed_commits
def main():
args = get_args()
failed_commits = []
if args.debug: