src/actions.ts — metadata queries (listActionRuns, getActionRun, listActionJobs) #114
Labels
No labels
bug
chore
documentation
enhancement
feature
ready
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
david/pi-extensions-and-skills#114
Loading…
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
New module
src/actions.tswith the three live metadata queries:listActionRuns(),getActionRun(),listActionJobs()— read-only, never cached, matching the Forgejo v16 Actions API surface.Background
Part of the Forgejo Actions tooling feature (tracking issue #111 — branch
feature/issue-111/forgejo-actions-tools, commitsissue-111: ...). These functions wrap the existingforgejoApiCall()fromsrc/api.ts(same host/owner/repo override +Result<T, ApiError>pattern assrc/issues.ts/src/pulls.ts). They power theforgejo_action_runs,forgejo_action_run_view, andforgejo_action_jobstools. Baseline is Forgejo v16; job details and?step=/?q=/?format=ndjsonare v17+ — out of scope.Documentation Required
docs/reference/forgejo-actions-api//api/v1),Authorization: token <TOKEN>header, token scopes (this feature needsread:repositoryonly), and links to the live swagger.status,event,ref,head_sha,run_number,workflow_id,page,limit) and response shapes.A separate process downloads these into
docs/reference/forgejo-actions-api/before this issue is implemented. Check that folder for the actual reference material before starting.Implementation Details
listActionRuns({host, owner, repo, status?, event?, ref?, headSha?, runNumber?, workflowId?, page?, limit?})GET /repos/{owner}/{repo}/actions/runswith 1:1 query-param mapping —status/eventaccept arrays (repeat the param per value), plusref(e.g.refs/heads/main),head_sha,run_number,workflow_id,page,limit. No server-side actor/time-range filters exist — do not invent them.getActionRun({host, owner, repo, runId})—GET /repos/{owner}/{repo}/actions/runs/{run_id}.listActionJobs({host, owner, repo, runId})—GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs(no pagination params exist for this endpoint).forgejoApiCall's error mapping (404 unknown run/job →ApiError); returnResult<T, ApiError>.src/issues.ts(explicit option interfaces,omitUndefined-style payload handling where relevant).Acceptance Criteria
listActionRuns()builds the URL with the exact path and maps every supported filter to its query param (arrays repeated per value); omitted filters are absent from the query string.getActionRun()hits/repos/{owner}/{repo}/actions/runs/{run_id}and returns the run.listActionJobs()hits/repos/{owner}/{repo}/actions/runs/{run_id}/jobswith no query params.Result<T, ApiError>; a 404 propagates asApiError(not a thrown exception).fetchvia the existingforgejoApiCalltest pattern) cover URL/query building for every filter combination and the 404/network error paths.npm run checkpasses.Test Plan
cd extensions/forgejo && npm test—tests/actions.test.tscovers URL/query construction and error mapping with mocked fetch.git.excelera.netis v10.0.3 / Gitea 1.22 and does not expose these endpoints): callforgejo_action_runswithstatus[]=failure, thenforgejo_action_run_viewon a returnedrun_id, thenforgejo_action_jobson it, verifying live JSON.pi-loop opened and merged a pull request for this issue: #126