update swagger

This commit is contained in:
Andrii Chyrva 2025-03-09 16:49:47 +00:00
parent 7455b96a2f
commit d4ca763832
4 changed files with 55 additions and 7 deletions

View file

@ -13,3 +13,12 @@ type DispatchWorkflowOption struct {
// Input keys and values configured in the workflow file.
Inputs map[string]string `json:"inputs"`
}
// DispatchWorkflowRun represents a workflow run
// swagger:model
type DispatchWorkflowRun struct {
// the workflow run id
ID int64 `json:"id"`
// the jobs name
Jobs []string `json:"jobs"`
}

View file

@ -612,11 +612,6 @@ func ListActionTasks(ctx *context.APIContext) {
ctx.JSON(http.StatusOK, &res)
}
type ActionRun struct {
ID int64
Jobs []string
}
// DispatchWorkflow dispatches a workflow
func DispatchWorkflow(ctx *context.APIContext) {
// swagger:operation POST /repos/{owner}/{repo}/actions/workflows/{workflowname}/dispatches repository DispatchWorkflow
@ -644,7 +639,11 @@ func DispatchWorkflow(ctx *context.APIContext) {
// in: body
// schema:
// "$ref": "#/definitions/DispatchWorkflowOption"
// produces:
// - application/json
// responses:
// "201":
// "$ref": "#/responses/DispatchWorkflowRun"
// "204":
// "$ref": "#/responses/empty"
// "404":
@ -685,10 +684,10 @@ func DispatchWorkflow(ctx *context.APIContext) {
return
}
actionRun := &ActionRun{
workflowRun := &api.DispatchWorkflowRun{
ID: run.ID,
Jobs: jobs,
}
ctx.JSON(http.StatusOK, actionRun)
ctx.JSON(http.StatusCreated, workflowRun)
}

View file

@ -39,3 +39,10 @@ type swaggerRunJobList struct {
// in:body
Body []*api.ActionRunJob `json:"body"`
}
// DispatchWorkflowRun is a Workflow Run after dispatching
// swagger:response DispatchWorkflowRun
type swaggerDispatchWorkflowRun struct {
// in:body
Body *api.DispatchWorkflowRun `json:"body"`
}

View file

@ -5378,6 +5378,9 @@
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"repository"
],
@ -5414,6 +5417,9 @@
}
],
"responses": {
"201": {
"$ref": "#/responses/DispatchWorkflowRun"
},
"204": {
"$ref": "#/responses/empty"
},
@ -23132,6 +23138,27 @@
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
"DispatchWorkflowRun": {
"description": "DispatchWorkflowRun represents a workflow run",
"type": "object",
"properties": {
"id": {
"description": "the workflow run id",
"type": "integer",
"format": "int64",
"x-go-name": "ID"
},
"jobs": {
"description": "the jobs name",
"type": "array",
"items": {
"type": "string"
},
"x-go-name": "Jobs"
}
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
"EditAttachmentOptions": {
"description": "EditAttachmentOptions options for editing attachments",
"type": "object",
@ -28511,6 +28538,12 @@
}
}
},
"DispatchWorkflowRun": {
"description": "DispatchWorkflowRun is a Workflow Run after dispatching",
"schema": {
"$ref": "#/definitions/DispatchWorkflowRun"
}
},
"EmailList": {
"description": "EmailList",
"schema": {