1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-08-05 09:55:20 +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:
Earl Warren 2025-07-11 05:07:33 +02:00 committed by 0ko
parent a8d8a4c106
commit 316073a925
3 changed files with 7 additions and 7 deletions

View file

@ -1177,7 +1177,7 @@ func Routes() *web.Route {
})
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)
})
})

View file

@ -615,7 +615,7 @@ func ListActionTasks(ctx *context.APIContext) {
// DispatchWorkflow dispatches a workflow
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
// consumes:
@ -631,7 +631,7 @@ func DispatchWorkflow(ctx *context.APIContext) {
// description: name of the repo
// type: string
// required: true
// - name: workflowname
// - name: workflowfilename
// in: path
// description: name of the workflow
// type: string
@ -649,13 +649,13 @@ func DispatchWorkflow(ctx *context.APIContext) {
// "$ref": "#/responses/notFound"
opt := web.GetForm(ctx).(*api.DispatchWorkflowOption)
name := ctx.Params("workflowname")
name := ctx.Params("workflowfilename")
if len(opt.Ref) == 0 {
ctx.Error(http.StatusBadRequest, "ref", "ref is empty")
return
} 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
}

View file

@ -5533,7 +5533,7 @@
}
}
},
"/repos/{owner}/{repo}/actions/workflows/{workflowname}/dispatches": {
"/repos/{owner}/{repo}/actions/workflows/{workflowfilename}/dispatches": {
"post": {
"consumes": [
"application/json"
@ -5561,7 +5561,7 @@
{
"type": "string",
"description": "name of the workflow",
"name": "workflowname",
"name": "workflowfilename",
"in": "path",
"required": true
},