18 lines
590 B
Python
18 lines
590 B
Python
"""Thin, agnostic client for the Gitea Actions API.
|
|
|
|
Only reads what's needed to build a build/deploy status report: the jobs
|
|
and steps of a single workflow run.
|
|
"""
|
|
|
|
from typing import Any
|
|
|
|
|
|
def fetch_run_jobs(base_url: str, token: str, owner: str, repo: str, run_id) -> list[dict[str, Any]]:
|
|
"""Get a Gitea Action job state"""
|
|
import requests
|
|
|
|
url = f"{base_url}/api/v1/repos/{owner}/{repo}/actions/runs/{run_id}/jobs"
|
|
response = requests.get(url, headers={"Authorization": f"token {token}"}, timeout=10)
|
|
response.raise_for_status()
|
|
return response.json()["jobs"]
|