Skip to content

Commit d2f2221

Browse files
committed
Add Actions API endpoints for workflow run and job management
Implements comprehensive REST API endpoints for GitHub Actions workflow runs: - POST /actions/runs/{run}/rerun - Rerun entire workflow run - POST /actions/runs/{run}/cancel - Cancel running workflow - POST /actions/runs/{run}/approve - Approve workflow requiring approval - POST /actions/runs/{run}/jobs/{job_id}/rerun - Rerun specific job - GET /actions/runs/{run}/logs - Download run logs archive - GET /actions/runs/{run}/jobs/{job_id}/logs - Download job logs - POST /actions/runs/{run}/logs - Stream logs with cursor support Features: - Proper permission checks and workflow validation - Support for "latest" run parameter - Job dependency handling for reruns - Streaming log API with cursor-based pagination - Comprehensive test coverage Fixes workflow management gaps in API compatibility.
1 parent 0c6326e commit d2f2221

File tree

4 files changed

+1023
-0
lines changed

4 files changed

+1023
-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)