in scripts/update_github_status.py [0:0]
def extract_jobs(raw_commits: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
commits = []
for raw_commit in raw_commits:
if raw_commit["status"] is None:
# Will be none if no non-GHA jobs were triggered
status = []
else:
status = extract_status(raw_commit["status"]["contexts"])
gha = extract_gha(raw_commit["checkSuites"]["edges"])
jobs = status + gha
if raw_commit["author"]["user"] is None:
author = raw_commit["author"]["name"]
else:
author = raw_commit["author"]["user"]["login"]
commits.append(
{
"sha": raw_commit["oid"],
"headline": raw_commit["messageHeadline"],
"body": raw_commit["messageBody"],
"author": author,
"date": raw_commit["authoredDate"],
"jobs": jobs,
}
)
return commits