feat(actions): add bounded workflow job logs #378
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/OpenSpec
Kind/Security
Kind/Testing
Priority/Critical
Priority/High
Priority/Low
Priority/Medium
RFC - Request For Comments
Reviewed/Confirmed
Reviewed/Duplicate
Reviewed/Invalid
Reviewed/Won't Fix
Status/Abandoned
Status/Blocked
Status/Need More Info
hermes-attempted
hermes-needs-clarification
hermes-ready
hermes-review
hermes-wip
human-required
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
agentic-forges/forgejo-mcp!378
Loading…
Reference in a new issue
No description provided.
Delete branch "codex/forgejo-v16-action-logs"
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?
Forgejo version 16 was released today and I'm eager to start using the new API endpoints for retrieving workflow logs. Thanks for considering this PR.
Summary
Closes #212.
Adds two Forgejo v16+ Actions tools:
list_action_run_jobslists the jobs belonging to a workflow run.get_action_job_logsreads bounded, resumable ranges from a job's plaintext log.Together, these let MCP clients identify a failed job and inspect its output through the Forgejo API, without scraping the web UI or requiring SSH/filesystem access to the server.
Design
Forgejo v16 exposes:
GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobsGET /repos/{owner}/{repo}/actions/jobs/{job_id}/logsThe pinned
forgejo-sdk/v3does not expose either endpoint, so this reuses the repository's established raw-HTTP layer:pkg/forgejo.DoJSON.DoAPIRawcounterpart in the same package, preserving existing authentication, user-agent, request logging, and error handling.SafeTextResultso CI output is not copied into debug logs.No SDK dependency change is required.
The run-wide ZIP endpoint is intentionally omitted because it does not support ranged reads. Per-job plaintext logs provide a bounded and resumable MCP surface.
Output-bounding checklist
list_action_run_jobspageandlimit, capped at 100 jobs per response.total_count,has_next, andnext_page.get_action_job_logsoffsetandmax_bytes.offsetreturns the log tail.Rangerequest, bounding both transfer and MCP output.previous_max_bytesprevents overlap when the preceding chunk is shorter than the requested size.Both tools document their bounds in the tool schema and README.
Tests
Automated coverage includes:
Content-Rangeresponses.Accept/Rangeheaders, response metadata, and over-limit rejection.Verification
make buildgo mod tidyandgo mod verifygo vet ./...gofmtcleangolangci-lintgo test -race -shuffle=on -count=1 ./...govulncheck ./...with Go 1.26.5The API contracts are exercised with
httptestservers.Documentation
This supersedes the approach proposed in #126 using the now-stable Forgejo v16 API and incorporates its review feedback: centralized HTTP handling, automated tests, README coverage, and standardized bounded/resumable output.
op1st Pipelines as Code is skipping this commit.
User dismantl is not allowed to trigger CI via pull_request in this repo.
/ok-to-test
op1st Pipelines as Code/forgejo-mcp-code-scans-mp4bz is running.
Starting Pipelinerun forgejo-mcp-code-scans-mp4bz in namespace op1st-pipelines
You can monitor the execution using the op1st Pipelines as Code PipelineRun viewer or through the command line by
using the tkn CLI with the following command:
tkn pr logs -n op1st-pipelines forgejo-mcp-code-scans-mp4bz -fop1st Pipelines as Code/forgejo-mcp-on-pull-request-mlp9s is running.
Starting Pipelinerun forgejo-mcp-on-pull-request-mlp9s in namespace op1st-pipelines
You can monitor the execution using the op1st Pipelines as Code PipelineRun viewer or through the command line by
using the tkn CLI with the following command:
tkn pr logs -n op1st-pipelines forgejo-mcp-on-pull-request-mlp9s -fop1st Pipelines as Code/forgejo-mcp-code-scans-mp4bz has successfully validated your commit.
Task Statuses:
fetch-source
gitleaks-version
gitleaks
op1st Pipelines as Code/forgejo-mcp-on-pull-request-mlp9s has successfully validated your commit.
Task Statuses:
fetch-source
build-and-test
commit-title-check