Skip to content

Commit d78b91e

Browse files
committed
Add action runner management API endpoints
Implements comprehensive API endpoints for managing action workflow runs: - POST /api/v1/repos/{owner}/{repo}/actions/runs/{run}/rerun Rerun a workflow run and all its jobs - POST /api/v1/repos/{owner}/{repo}/actions/runs/{run}/cancel Cancel a workflow run and all running jobs - POST /api/v1/repos/{owner}/{repo}/actions/runs/{run}/approve Approve a workflow run requiring approval - POST /api/v1/repos/{owner}/{repo}/actions/runs/{run}/jobs/{job_id}/rerun Rerun a specific job and its dependent jobs - GET /api/v1/repos/{owner}/{repo}/actions/runs/{run}/logs Download workflow run logs as archive - GET /api/v1/repos/{owner}/{repo}/actions/runs/{run}/jobs/{job_id}/logs Download specific job logs - POST /api/v1/repos/{owner}/{repo}/actions/runs/{run}/logs Stream workflow run logs with cursor support for real-time viewing Features: - Leverages existing web UI business logic for consistency - Proper permission checking (requires repo write access) - Support for "latest" run parameter - Dependency-aware job rerunning using existing service logic - Comprehensive error handling and validation - Real-time log streaming with cursor-based pagination - Full integration test coverage This enables CLI tools to provide equivalent functionality to GitHub's 'gh run' command for Gitea instances.
1 parent 4b19e29 commit d78b91e

File tree

3 files changed

+1011
-0
lines changed

3 files changed

+1011
-0
lines changed

routers/api/v1/api.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,7 +1289,16 @@ func Routes() *web.Router {
12891289
m.Group("/{run}", func() {
12901290
m.Get("", repo.GetWorkflowRun)
12911291
m.Delete("", reqToken(), reqRepoWriter(unit.TypeActions), repo.DeleteActionRun)
1292+
m.Post("/rerun", reqToken(), reqRepoWriter(unit.TypeActions), repo.RerunWorkflowRun)
1293+
m.Post("/cancel", reqToken(), reqRepoWriter(unit.TypeActions), repo.CancelWorkflowRun)
1294+
m.Post("/approve", reqToken(), reqRepoWriter(unit.TypeActions), repo.ApproveWorkflowRun)
12921295
m.Get("/jobs", repo.ListWorkflowRunJobs)
1296+
m.Group("/jobs", func() {
1297+
m.Post("/{job_id}/rerun", reqToken(), reqRepoWriter(unit.TypeActions), repo.RerunWorkflowJob)
1298+
m.Get("/{job_id}/logs", repo.GetWorkflowJobLogs)
1299+
})
1300+
m.Get("/logs", repo.GetWorkflowRunLogs)
1301+
m.Post("/logs", reqToken(), reqRepoReader(unit.TypeActions), repo.GetWorkflowRunLogsStream)
12931302
m.Get("/artifacts", repo.GetArtifactsOfRun)
12941303
})
12951304
})

0 commit comments

Comments
 (0)