Co-authored-by: gobha <jasafpro@gmail.com> Co-committed-by: gobha <jasafpro@gmail.com>
26 lines
833 B
Plaintext
26 lines
833 B
Plaintext
# gitea-client — CI status operations
|
|
|
|
load("star/http_helpers.star", "gitea_get")
|
|
|
|
def get_ci_status(conn, owner, repo, ref):
|
|
"""Get CI/CD job status for a commit or branch reference."""
|
|
path = "/repos/" + owner + "/" + repo + "/commits/" + ref + "/status"
|
|
data = gitea_get(conn, path)
|
|
if data == None:
|
|
return None
|
|
statuses = data.get("statuses", [])
|
|
items = []
|
|
for s in statuses:
|
|
items.append({
|
|
"context": s.get("context", s.get("name", "")),
|
|
"state": s.get("state", s.get("status", "")),
|
|
"description": s.get("description", ""),
|
|
"target_url": s.get("target_url", ""),
|
|
})
|
|
return {
|
|
"ref": ref,
|
|
"state": data.get("state", ""),
|
|
"statuses": items,
|
|
"count": len(items),
|
|
}
|