Enable bots to read Actions results via API #144

Open
opened 2026-02-27 13:09:11 +00:00 by nazim · 0 comments
Contributor

Problem

Bots working on this repo (e.g. CI notification agents, coding agents opening PRs) currently cannot programmatically check whether Actions passed or failed, read job logs, or download artifacts.

What's Available (Forgejo v14.0.2)

Capability API Endpoint Status
List workflow runs GET /repos/{owner}/{repo}/actions/runs Available
Get specific run (status, duration, SHA) GET /repos/{owner}/{repo}/actions/runs/{run_id} Available
Filter runs by event/status/sha query params on runs endpoint Available
Search jobs by runner labels GET /repos/{owner}/{repo}/actions/runners/jobs Available
Trigger workflow POST /repos/{owner}/{repo}/actions/workflows/{name}/dispatches Available
Download job logs not implemented Missing
List/download artifacts not implemented Missing
List workflows / enable / disable not implemented Missing
List jobs for a specific run not implemented Missing

The missing endpoints exist in Gitea 1.26+dev (unreleased upstream):

  • GET /actions/jobs/{job_id}/logs
  • GET /actions/artifacts + GET /actions/artifacts/{id}/zip
  • GET /actions/runs/{run}/jobs
  • GET /actions/workflows

Workarounds (for now)

  1. Poll run status — bots can check if CI passed via:
    GET /api/v1/repos/ultanio/cobot/actions/runs?head_sha={commit_sha}
    
  2. Webhook on workflow completion — configure a repo webhook for Workflow Run events so the bot gets POSTed the result automatically
  3. Self-reporting workflows — have CI steps post a summary comment on the PR/issue via the existing comments API
  4. Web UI scraping — use html_url from run response as fallback for reading logs

Action Items

  • Set up bot API token with appropriate scopes for CI status polling
  • Implement run status polling in bot workflow (using available v14 endpoints)
  • Consider adding a webhook for workflow completion events
  • Watch for Forgejo v15+ to pick up Gitea job log + artifacts API endpoints

References

## Problem Bots working on this repo (e.g. CI notification agents, coding agents opening PRs) currently cannot programmatically check whether Actions passed or failed, read job logs, or download artifacts. ## What's Available (Forgejo v14.0.2) | Capability | API Endpoint | Status | |---|---|---| | List workflow runs | `GET /repos/{owner}/{repo}/actions/runs` | Available | | Get specific run (status, duration, SHA) | `GET /repos/{owner}/{repo}/actions/runs/{run_id}` | Available | | Filter runs by event/status/sha | query params on runs endpoint | Available | | Search jobs by runner labels | `GET /repos/{owner}/{repo}/actions/runners/jobs` | Available | | Trigger workflow | `POST /repos/{owner}/{repo}/actions/workflows/{name}/dispatches` | Available | | Download job logs | not implemented | Missing | | List/download artifacts | not implemented | Missing | | List workflows / enable / disable | not implemented | Missing | | List jobs for a specific run | not implemented | Missing | The missing endpoints exist in **Gitea 1.26+dev** (unreleased upstream): - `GET /actions/jobs/{job_id}/logs` - `GET /actions/artifacts` + `GET /actions/artifacts/{id}/zip` - `GET /actions/runs/{run}/jobs` - `GET /actions/workflows` ## Workarounds (for now) 1. **Poll run status** — bots can check if CI passed via: ``` GET /api/v1/repos/ultanio/cobot/actions/runs?head_sha={commit_sha} ``` 2. **Webhook on workflow completion** — configure a repo webhook for Workflow Run events so the bot gets POSTed the result automatically 3. **Self-reporting workflows** — have CI steps post a summary comment on the PR/issue via the existing comments API 4. **Web UI scraping** — use `html_url` from run response as fallback for reading logs ## Action Items - [ ] Set up bot API token with appropriate scopes for CI status polling - [ ] Implement run status polling in bot workflow (using available v14 endpoints) - [ ] Consider adding a webhook for workflow completion events - [ ] Watch for Forgejo v15+ to pick up Gitea job log + artifacts API endpoints ## References - Instance swagger: https://forgejo.tail593e12.ts.net/api/swagger - Gitea 1.26+dev swagger (full Actions API): https://demo.gitea.com/api/swagger - Forgejo releases: https://forgejo.org/releases/
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ultanio/cobot#144
No description provided.