diff --git a/modules/structs/repo_actions.go b/modules/structs/repo_actions.go index 933a9f77f9..b19db3cbdb 100644 --- a/modules/structs/repo_actions.go +++ b/modules/structs/repo_actions.go @@ -107,13 +107,13 @@ type ActionWorkflowRun struct { CompletedAt time.Time `json:"completed_at,omitempty"` } -// ActionArtifactsResponse returns ActionArtifacts +// ActionWorkflowRunsResponse returns ActionWorkflowRuns type ActionWorkflowRunsResponse struct { Entries []*ActionWorkflowRun `json:"workflow_runs"` TotalCount int64 `json:"total_count"` } -// ActionArtifactsResponse returns ActionArtifacts +// ActionWorkflowJobsResponse returns ActionWorkflowJobs type ActionWorkflowJobsResponse struct { Entries []*ActionWorkflowJob `json:"jobs"` TotalCount int64 `json:"total_count"` diff --git a/routers/api/v1/admin/runners.go b/routers/api/v1/admin/runners.go index 8fad9304ab..97e80d59a9 100644 --- a/routers/api/v1/admin/runners.go +++ b/routers/api/v1/admin/runners.go @@ -112,7 +112,7 @@ func ListWorkflowJobs(ctx *context.APIContext) { // - application/json // responses: // "200": - // "$ref": "#/responses/JobList" + // "$ref": "#/responses/WorkflowJobsList" // "400": // "$ref": "#/responses/error" // "404": @@ -130,7 +130,7 @@ func ListWorkflowRuns(ctx *context.APIContext) { // - application/json // responses: // "200": - // "$ref": "#/responses/RunList" + // "$ref": "#/responses/WorkflowRunsList" // "400": // "$ref": "#/responses/error" // "404": diff --git a/routers/api/v1/repo/action.go b/routers/api/v1/repo/action.go index f20ec410a9..7370471ac0 100644 --- a/routers/api/v1/repo/action.go +++ b/routers/api/v1/repo/action.go @@ -670,7 +670,7 @@ func (Action) ListWorkflowJobs(ctx *context.APIContext) { // required: true // responses: // "200": - // "$ref": "#/responses/JobList" + // "$ref": "#/responses/WorkflowJobsList" // "400": // "$ref": "#/responses/error" // "404": @@ -1094,7 +1094,7 @@ func GetWorkflowRun(ctx *context.APIContext) { // required: true // responses: // "200": - // "$ref": "#/responses/Artifact" + // "$ref": "#/responses/WorkflowRun" // "400": // "$ref": "#/responses/error" // "404": @@ -1140,7 +1140,7 @@ func ListWorkflowRunJobs(ctx *context.APIContext) { // required: true // responses: // "200": - // "$ref": "#/responses/JobList" + // "$ref": "#/responses/WorkflowJobsList" // "400": // "$ref": "#/responses/error" // "404": @@ -1178,7 +1178,7 @@ func GetWorkflowJob(ctx *context.APIContext) { // required: true // responses: // "200": - // "$ref": "#/responses/Job" + // "$ref": "#/responses/WorkflowJob" // "400": // "$ref": "#/responses/error" // "404": diff --git a/routers/api/v1/swagger/repo.go b/routers/api/v1/swagger/repo.go index df0c8a805a..df043b71d3 100644 --- a/routers/api/v1/swagger/repo.go +++ b/routers/api/v1/swagger/repo.go @@ -443,6 +443,34 @@ type swaggerRepoTasksList struct { Body api.ActionTaskResponse `json:"body"` } +// WorkflowRunsList +// swagger:response WorkflowRunsList +type swaggerActionWorkflowRunsResponse struct { + // in:body + Body api.ActionWorkflowRunsResponse `json:"body"` +} + +// WorkflowRun +// swagger:response WorkflowRun +type swaggerWorkflowRun struct { + // in:body + Body api.ActionWorkflowRun `json:"body"` +} + +// WorkflowJobsList +// swagger:response WorkflowJobsList +type swaggerActionWorkflowJobsResponse struct { + // in:body + Body api.ActionWorkflowJobsResponse `json:"body"` +} + +// WorkflowJob +// swagger:response WorkflowJob +type swaggerWorkflowJob struct { + // in:body + Body api.ActionWorkflowJob `json:"body"` +} + // ArtifactsList // swagger:response ArtifactsList type swaggerRepoArtifactsList struct { diff --git a/routers/api/v1/user/runners.go b/routers/api/v1/user/runners.go index 2409d28685..70b608d006 100644 --- a/routers/api/v1/user/runners.go +++ b/routers/api/v1/user/runners.go @@ -125,6 +125,6 @@ func ListWorkflowJobs(ctx *context.APIContext) { // - application/json // responses: // "200": - // "$ref": "#/responses/ActionWorkflowJobsResponse" + // "$ref": "#/responses/WorkflowJobsList" shared.ListJobs(ctx, ctx.Doer.ID, 0, 0) } diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index 707e226f5e..4fcf4090e1 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -87,7 +87,7 @@ "operationId": "listAdminWorkflowJobs", "responses": { "200": { - "$ref": "#/responses/JobList" + "$ref": "#/responses/WorkflowJobsList" }, "400": { "$ref": "#/responses/error" @@ -212,7 +212,7 @@ "operationId": "listAdminWorkflowRuns", "responses": { "200": { - "$ref": "#/responses/RunList" + "$ref": "#/responses/WorkflowRunsList" }, "400": { "$ref": "#/responses/error" @@ -4635,7 +4635,7 @@ ], "responses": { "200": { - "$ref": "#/responses/JobList" + "$ref": "#/responses/WorkflowJobsList" }, "400": { "$ref": "#/responses/error" @@ -4681,7 +4681,7 @@ ], "responses": { "200": { - "$ref": "#/responses/Job" + "$ref": "#/responses/WorkflowJob" }, "400": { "$ref": "#/responses/error" @@ -5023,7 +5023,7 @@ ], "responses": { "200": { - "$ref": "#/responses/Artifact" + "$ref": "#/responses/WorkflowRun" }, "400": { "$ref": "#/responses/error" @@ -5121,7 +5121,7 @@ ], "responses": { "200": { - "$ref": "#/responses/JobList" + "$ref": "#/responses/WorkflowJobsList" }, "400": { "$ref": "#/responses/error" @@ -17801,7 +17801,7 @@ "operationId": "getUserWorkflowJobs", "responses": { "200": { - "$ref": "#/responses/ActionWorkflowJobsResponse" + "$ref": "#/responses/WorkflowJobsList" } } } @@ -20682,6 +20682,117 @@ }, "x-go-package": "code.gitea.io/gitea/modules/structs" }, + "ActionWorkflowJob": { + "description": "ActionWorkflowJob represents a WorkflowJob", + "type": "object", + "properties": { + "completed_at": { + "type": "string", + "format": "date-time", + "x-go-name": "CompletedAt" + }, + "conclusion": { + "type": "string", + "x-go-name": "Conclusion" + }, + "created_at": { + "type": "string", + "format": "date-time", + "x-go-name": "CreatedAt" + }, + "head_branch": { + "type": "string", + "x-go-name": "HeadBranch" + }, + "head_sha": { + "type": "string", + "x-go-name": "HeadSha" + }, + "html_url": { + "type": "string", + "x-go-name": "HTMLURL" + }, + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "labels": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Labels" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "run_attempt": { + "type": "integer", + "format": "int64", + "x-go-name": "RunAttempt" + }, + "run_id": { + "type": "integer", + "format": "int64", + "x-go-name": "RunID" + }, + "run_url": { + "type": "string", + "x-go-name": "RunURL" + }, + "runner_id": { + "type": "integer", + "format": "int64", + "x-go-name": "RunnerID" + }, + "runner_name": { + "type": "string", + "x-go-name": "RunnerName" + }, + "started_at": { + "type": "string", + "format": "date-time", + "x-go-name": "StartedAt" + }, + "status": { + "type": "string", + "x-go-name": "Status" + }, + "steps": { + "type": "array", + "items": { + "$ref": "#/definitions/ActionWorkflowStep" + }, + "x-go-name": "Steps" + }, + "url": { + "type": "string", + "x-go-name": "URL" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "ActionWorkflowJobsResponse": { + "description": "ActionWorkflowJobsResponse returns ActionWorkflowJobs", + "type": "object", + "properties": { + "jobs": { + "type": "array", + "items": { + "$ref": "#/definitions/ActionWorkflowJob" + }, + "x-go-name": "Entries" + }, + "total_count": { + "type": "integer", + "format": "int64", + "x-go-name": "TotalCount" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, "ActionWorkflowRun": { "description": "ActionWorkflowRun represents a WorkflowRun", "type": "object", @@ -20761,6 +20872,59 @@ }, "x-go-package": "code.gitea.io/gitea/modules/structs" }, + "ActionWorkflowRunsResponse": { + "description": "ActionWorkflowRunsResponse returns ActionWorkflowRuns", + "type": "object", + "properties": { + "total_count": { + "type": "integer", + "format": "int64", + "x-go-name": "TotalCount" + }, + "workflow_runs": { + "type": "array", + "items": { + "$ref": "#/definitions/ActionWorkflowRun" + }, + "x-go-name": "Entries" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "ActionWorkflowStep": { + "description": "ActionWorkflowStep represents a step of a WorkflowJob", + "type": "object", + "properties": { + "completed_at": { + "type": "string", + "format": "date-time", + "x-go-name": "CompletedAt" + }, + "conclusion": { + "type": "string", + "x-go-name": "Conclusion" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "number": { + "type": "integer", + "format": "int64", + "x-go-name": "Number" + }, + "started_at": { + "type": "string", + "format": "date-time", + "x-go-name": "StartedAt" + }, + "status": { + "type": "string", + "x-go-name": "Status" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, "Activity": { "type": "object", "properties": { @@ -28873,6 +29037,30 @@ } } }, + "WorkflowJob": { + "description": "WorkflowJob", + "schema": { + "$ref": "#/definitions/ActionWorkflowJob" + } + }, + "WorkflowJobsList": { + "description": "WorkflowJobsList", + "schema": { + "$ref": "#/definitions/ActionWorkflowJobsResponse" + } + }, + "WorkflowRun": { + "description": "WorkflowRun", + "schema": { + "$ref": "#/definitions/ActionWorkflowRun" + } + }, + "WorkflowRunsList": { + "description": "WorkflowRunsList", + "schema": { + "$ref": "#/definitions/ActionWorkflowRunsResponse" + } + }, "conflict": { "description": "APIConflict is a conflict empty response" },