Forgejo Actions: find (or build) an API endpoint for action job/step logs #166
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
There is no obvious token-authable
/api/v1endpoint to fetch the step logs (or even the job list) for a Forgejo Actions run. The web UI renders per-step logs fine, so the data exists. We need to find the right endpoint, and if one genuinely does not exist on this version, build a wrapper (or contribute upstream).Context
Surfaced while verifying infrastructure#163 (cross-node flannel fix). A scheduled
caddy-shortcuts->regeneraterun failed (run_number 112) and I wanted to pull its step log programmatically to characterize the failure. Could not, so the failure was diagnosed by elimination instead of by reading the log.What works
GET /api/v1/repos/coilysiren/infrastructure/actions/runs/112-> 200. Returns run metadata only. Keys:id, index_in_repo, status, workflow_id, html_url, event, trigger_event, trigger_user, commit_sha, started, stopped, .... Nojobsarray, nologs/ log-download URL.GET /api/v1/repos/coilysiren/infrastructure/actions/tasks?limit=N-> 200. Lists tasks (id, status, name, event, run_number, created_at). Also no per-task log link.What returns 404
All probed against
forgejo.coilysiren.me,Authorization: token </forgejo/api-token>:/actions/runs/112/jobs/actions/runs/138/jobs/actions/tasks/138/logs/actions/jobs/138/logs/actions/jobs/138Environment
15.0.2+gitea-1.22.0(fromGET /api/v1/version).Asks / next steps
/api/v1path for Actions job logs on this Forgejo version (check the live swagger at/api/swagger, since the path/id type may differ from the GitHub convention, e.g. job id vs run_number vs task id).coily opshelper that fetches run/job step logs so agents can read CI failures directly.coilywrapper around the web route the UI uses, or (b) an upstream Forgejo contribution to expose job logs over/api/v1.Relates to coilysiren/infrastructure#163.
Checked the live swagger (
/swagger.v1.json) onforgejo.coilysiren.me. Definitive result:No logs endpoint exists in
/api/v1on this version. Zero paths in the whole spec contain the stringlog.Full set of repo Actions endpoints in
15.0.2+gitea-1.22.0:GET /repos/{owner}/{repo}/actions/runs- list runsGET /repos/{owner}/{repo}/actions/runs/{run_id}- get one run (metadata only)GET /repos/{owner}/{repo}/actions/tasks- list tasksGET /repos/{owner}/{repo}/actions/runners/jobs- search jobs (filterable)Correction to the issue body above: the job list is in fact reachable via
GET /actions/runners/jobs(I had wrongly treated that as runner-only). So the gap is narrower than first stated: jobs are queryable, step/job logs are not. The web UI fetches logs over a non-/api/v1web route.Revised next step: this is a real API gap, not a wrong-path mistake. Options:
coilywrapper around the web log route the UI uses (cookie/session auth), orGET /repos/{owner}/{repo}/actions/jobs/{job_id}/logsto/api/v1.