Skip to content

Commit 3d53ed9

Browse files
committed
Add Actions API endpoints for workflow run and job management
This commit adds comprehensive REST API endpoints for GitHub Actions workflow run and job operations, addressing requirements for: - Workflow run operations: approve, cancel, rerun - Job-specific operations: rerun individual jobs, download job logs - Log streaming: both archive download and incremental streaming - Enhanced job log access with proper error handling Key changes: - Add 6 new API endpoints in actions_run.go using consistent run ID approach - Add comprehensive integration tests with proper error scenarios - Update Swagger documentation for all new endpoints - Maintain backward compatibility with existing API patterns All endpoints follow established authentication and authorization patterns, with proper error handling and response formatting.
1 parent 198f37e commit 3d53ed9

File tree

5 files changed

+1447
-0
lines changed

5 files changed

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