run pre-commit formatting

This commit is contained in:
MicroDev 2023-01-07 19:00:54 +05:30
parent 09adb24284
commit 70273316f8
No known key found for this signature in database
GPG Key ID: 2C0867BE60967730
2 changed files with 26 additions and 22 deletions

View File

@ -143,27 +143,29 @@ def set_output(name, value):
def get_commit_depth_and_check_suite(query_commits):
while True:
commits = query_commits.fetch()["data"]["repository"]["pullRequest"]["commits"]
commits = query_commits.fetch()["data"]["repository"]["pullRequest"]["commits"]
if commits["totalCount"] > 0:
nodes = commits["nodes"]
nodes.reverse()
if nodes[0]["commit"]["oid"] == os.environ["EXCLUDE_COMMIT"]:
nodes.pop(0)
for index, commit in enumerate(nodes):
commit = commit["commit"]
commit_sha = commit["oid"]
check_suites = commit["checkSuites"]
if check_suites["totalCount"] > 0:
for check_suite in check_suites["nodes"]:
if check_suite["workflowRun"]["workflow"]["name"] == "Build CI":
return [
{"sha": commit_sha, "depth": index + 1},
check_suite["id"] if check_suite["conclusion"] != "SUCCESS" else None,
]
else:
if not query_commits.paginate(commits["pageInfo"], "beforeCommit"):
break
if commits["totalCount"] > 0:
nodes = commits["nodes"]
nodes.reverse()
if nodes[0]["commit"]["oid"] == os.environ["EXCLUDE_COMMIT"]:
nodes.pop(0)
for index, commit in enumerate(nodes):
commit = commit["commit"]
commit_sha = commit["oid"]
check_suites = commit["checkSuites"]
if check_suites["totalCount"] > 0:
for check_suite in check_suites["nodes"]:
if check_suite["workflowRun"]["workflow"]["name"] == "Build CI":
return [
{"sha": commit_sha, "depth": index + 1},
check_suite["id"]
if check_suite["conclusion"] != "SUCCESS"
else None,
]
else:
if not query_commits.paginate(commits["pageInfo"], "beforeCommit"):
break
return [None, None]
@ -197,7 +199,9 @@ def get_bad_check_runs(query_check_runs):
append_runs_to_list(check_runs[run_type], bad_runs_by_matrix)
if query_check_runs.paginate(check_runs[run_type]["pageInfo"], "after" + run_type_camel):
if query_check_runs.paginate(
check_runs[run_type]["pageInfo"], "after" + run_type_camel
):
query_check_runs.variables["include" + run_type_camel] = True
more_pages = True

View File

@ -71,7 +71,7 @@ run(
f'git fetch --recurse-submodules=no --shallow-since="2021-07-01" origin {ref}',
)
# See https://stackoverflow.com/questions/63878612/git-fatal-error-in-object-unshallow-sha-1#comment118418373_63879454
run ("Fix for bug \"fatal: error in object: unshallow\"", "git repack -d")
run('Fix for bug "fatal: error in object: unshallow"', "git repack -d")
run("Init submodules", "git submodule init")
run("Submodule status", "git submodule status")