in tools/release/release-verify.py [0:0]
def validate_checks(configs) -> list:
"""
Validates that all of the GHA and CBMC status checks passed on all repos.
Returns a list of existing org/repo paths found.
"""
docs_file = open("docs_to_review.txt", "w+")
repo_paths = []
for library_dir in CSDK_LIBRARY_DIRS:
# Get the submodules in the library directory.
git_resp = requests.get(
f"{GITHUB_API_URL}/repos/{CSDK_ORG}/{CSDK_REPO}/contents/{library_dir}?ref=main",
headers=GITHUB_AUTH_HEADER,
)
# A 404 status code means the branch doesn't exist.
if git_resp.status_code == 404:
log_error(
"The main branch does not exist in the CSDK. Please recheck the branches in the repo."
)
break
else:
# For each library submodule in this directory, get the status checks results and docs to review.
for library in git_resp.json():
library_name = library["name"]
# Get the commit SHA of the branch currently in main.
commit_sha = library["sha"]
# Get the organization of this repo
html_url = library["html_url"]
repo_path = re.search("(?<=\.com/)(.*)(?=/tree)", html_url).group(0)
repo_paths.append(repo_path)
# Verify CBMC checks for the libraries not excluded.
if library_name.lower() not in configs["libraries-to-disable-cbmc-checks"]:
# Get the status of the CBMC checks
git_resp = requests.get(
f"{GITHUB_API_URL}/repos/{repo_path}/commits/{commit_sha}/status", headers=GITHUB_AUTH_HEADER
)
if git_resp.json()["state"] != "success":
log_error(f"The CBMC status checks failed for {html_url}.")
# Get the status of the GHA checks
git_resp = requests.get(
f"{GITHUB_API_URL}/repos/{repo_path}/commits/{commit_sha}/check-runs", headers=GITHUB_AUTH_HEADER
)
for check_run in git_resp.json()["check_runs"]:
if check_run["conclusion"] != "success":
check_run_name = check_run["name"]
log_error(f"The GHA {check_run_name} check failed for {html_url}.")
# Collect the HTML URLS for reviewing the docs.
html_url = html_url.split(commit_sha)[0] + "main"
docs_file.write(f"{library_name}\n")
docs_file.write(f"{html_url}/README.md\n")
docs_file.write(f"{html_url}/CHANGELOG.md\n\n")
docs_file.close()
repo_paths.append(f"{CSDK_ORG}/{CSDK_REPO}")
return repo_paths