From 316073a92530b659a16548590de7c80950449d58 Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Fri, 11 Jul 2025 05:07:33 +0200 Subject: [PATCH] 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 Reviewed-by: Beowulf Co-authored-by: Earl Warren Co-committed-by: Earl Warren --- routers/api/v1/api.go | 2 +- routers/api/v1/repo/action.go | 8 ++++---- templates/swagger/v1_json.tmpl | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index fe13f85df4..3b66d02fba 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -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) }) }) diff --git a/routers/api/v1/repo/action.go b/routers/api/v1/repo/action.go index dbc4933de6..fe29d534ff 100644 --- a/routers/api/v1/repo/action.go +++ b/routers/api/v1/repo/action.go @@ -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 } diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index 0e8382b8ab..ee5e919757 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -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 },