mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-05 01:45:22 +02:00
fix: replace {workflowname} with {workflowfilename} in dispatch API (#8481)
The current {workflowname} in the API endpoint /repos/{owner}/{repo}/actions/workflows/{workflowname}/dispatches is misleading because it does not refer to the name of the workflow but to the filename in which the workflow is defined. Change to /repos/{owner}/{repo}/actions/workflows/{workflowfilename}/dispatches --- There is no need for testing because it is a documentation change. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8481 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Reviewed-by: Beowulf <beowulf@beocode.eu> Co-authored-by: Earl Warren <contact@earl-warren.org> Co-committed-by: Earl Warren <contact@earl-warren.org>
This commit is contained in:
parent
a8d8a4c106
commit
316073a925
3 changed files with 7 additions and 7 deletions
|
@ -1177,7 +1177,7 @@ func Routes() *web.Route {
|
||||||
})
|
})
|
||||||
|
|
||||||
m.Group("/workflows", func() {
|
m.Group("/workflows", func() {
|
||||||
m.Group("/{workflowname}", func() {
|
m.Group("/{workflowfilename}", func() {
|
||||||
m.Post("/dispatches", reqToken(), reqRepoWriter(unit.TypeActions), mustNotBeArchived, bind(api.DispatchWorkflowOption{}), repo.DispatchWorkflow)
|
m.Post("/dispatches", reqToken(), reqRepoWriter(unit.TypeActions), mustNotBeArchived, bind(api.DispatchWorkflowOption{}), repo.DispatchWorkflow)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -615,7 +615,7 @@ func ListActionTasks(ctx *context.APIContext) {
|
||||||
|
|
||||||
// DispatchWorkflow dispatches a workflow
|
// DispatchWorkflow dispatches a workflow
|
||||||
func DispatchWorkflow(ctx *context.APIContext) {
|
func DispatchWorkflow(ctx *context.APIContext) {
|
||||||
// swagger:operation POST /repos/{owner}/{repo}/actions/workflows/{workflowname}/dispatches repository DispatchWorkflow
|
// swagger:operation POST /repos/{owner}/{repo}/actions/workflows/{workflowfilename}/dispatches repository DispatchWorkflow
|
||||||
// ---
|
// ---
|
||||||
// summary: Dispatches a workflow
|
// summary: Dispatches a workflow
|
||||||
// consumes:
|
// consumes:
|
||||||
|
@ -631,7 +631,7 @@ func DispatchWorkflow(ctx *context.APIContext) {
|
||||||
// description: name of the repo
|
// description: name of the repo
|
||||||
// type: string
|
// type: string
|
||||||
// required: true
|
// required: true
|
||||||
// - name: workflowname
|
// - name: workflowfilename
|
||||||
// in: path
|
// in: path
|
||||||
// description: name of the workflow
|
// description: name of the workflow
|
||||||
// type: string
|
// type: string
|
||||||
|
@ -649,13 +649,13 @@ func DispatchWorkflow(ctx *context.APIContext) {
|
||||||
// "$ref": "#/responses/notFound"
|
// "$ref": "#/responses/notFound"
|
||||||
|
|
||||||
opt := web.GetForm(ctx).(*api.DispatchWorkflowOption)
|
opt := web.GetForm(ctx).(*api.DispatchWorkflowOption)
|
||||||
name := ctx.Params("workflowname")
|
name := ctx.Params("workflowfilename")
|
||||||
|
|
||||||
if len(opt.Ref) == 0 {
|
if len(opt.Ref) == 0 {
|
||||||
ctx.Error(http.StatusBadRequest, "ref", "ref is empty")
|
ctx.Error(http.StatusBadRequest, "ref", "ref is empty")
|
||||||
return
|
return
|
||||||
} else if len(name) == 0 {
|
} else if len(name) == 0 {
|
||||||
ctx.Error(http.StatusBadRequest, "workflowname", "workflow name is empty")
|
ctx.Error(http.StatusBadRequest, "workflowfilename", "workflow file name is empty")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
templates/swagger/v1_json.tmpl
generated
4
templates/swagger/v1_json.tmpl
generated
|
@ -5533,7 +5533,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/repos/{owner}/{repo}/actions/workflows/{workflowname}/dispatches": {
|
"/repos/{owner}/{repo}/actions/workflows/{workflowfilename}/dispatches": {
|
||||||
"post": {
|
"post": {
|
||||||
"consumes": [
|
"consumes": [
|
||||||
"application/json"
|
"application/json"
|
||||||
|
@ -5561,7 +5561,7 @@
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "name of the workflow",
|
"description": "name of the workflow",
|
||||||
"name": "workflowname",
|
"name": "workflowfilename",
|
||||||
"in": "path",
|
"in": "path",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue