Files
Notification/notification/gitea_api.py
T
stilobique b86ae38b03
Publish package / publish (push) Successful in 13s
Make basic package
2026-10-30 18:25:58 +01:00

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"]