Skip to content

Commit 267a53c

Browse files
committed
feat: add Actions API endpoints for workflow run and job management
1 parent 522c466 commit 267a53c

File tree

7 files changed

+1132
-1
lines changed

7 files changed

+1132
-1
lines changed

modules/structs/repo_actions.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ type ActionWorkflowRun struct {
123123
HeadRepository *Repository `json:"head_repository,omitempty"`
124124
Conclusion string `json:"conclusion,omitempty"`
125125
// swagger:strfmt date-time
126+
CreatedAt time.Time `json:"created_at"`
127+
// swagger:strfmt date-time
126128
StartedAt time.Time `json:"started_at"`
127129
// swagger:strfmt date-time
128130
CompletedAt time.Time `json:"completed_at"`

routers/api/v1/api.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1272,7 +1272,17 @@ func Routes() *web.Router {
12721272
m.Group("/{run}", func() {
12731273
m.Get("", repo.GetWorkflowRun)
12741274
m.Delete("", reqToken(), reqRepoWriter(unit.TypeActions), repo.DeleteActionRun)
1275-
m.Get("/jobs", repo.ListWorkflowRunJobs)
1275+
m.Post("/rerun", reqToken(), reqRepoWriter(unit.TypeActions), repo.RerunWorkflowRun)
1276+
m.Post("/cancel", reqToken(), reqRepoWriter(unit.TypeActions), repo.CancelWorkflowRun)
1277+
m.Post("/approve", reqToken(), reqRepoWriter(unit.TypeActions), repo.ApproveWorkflowRun)
1278+
m.Group("/jobs", func() {
1279+
m.Get("", repo.ListWorkflowRunJobs)
1280+
m.Post("/{job_id}/rerun", reqToken(), reqRepoWriter(unit.TypeActions), repo.RerunWorkflowJob)
1281+
})
1282+
m.Group("/logs", func() {
1283+
m.Get("", repo.GetWorkflowRunLogs)
1284+
m.Post("", reqToken(), reqRepoReader(unit.TypeActions), repo.GetWorkflowRunLogsStream)
1285+
})
12761286
m.Get("/artifacts", repo.GetArtifactsOfRun)
12771287
})
12781288
})

0 commit comments

Comments
 (0)