From 01e9ac05615c5b68bf6a947bc1ae4e930af09e09 Mon Sep 17 00:00:00 2001 From: Mai-Lapyst Date: Tue, 1 Oct 2024 09:22:43 +0200 Subject: [PATCH] Fix boolean inputs in workflow_dispatch; closes #5425 (cherry picked from commit 96c4ca249aafd033847e03b8d02027be147c6e62) --- routers/web/repo/actions/manual.go | 6 +++--- templates/repo/actions/dispatch.tmpl | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/routers/web/repo/actions/manual.go b/routers/web/repo/actions/manual.go index 86a6014761..949469fa21 100644 --- a/routers/web/repo/actions/manual.go +++ b/routers/web/repo/actions/manual.go @@ -1,5 +1,5 @@ -// Copyright The Forgejo Authors. -// SPDX-License-Identifier: MIT +// Copyright 2024 The Forgejo Authors. +// SPDX-License-Identifier: GPL-3.0-or-later package actions @@ -43,7 +43,7 @@ func ManualRunWorkflow(ctx *context_module.Context) { formKeyGetter := func(key string) string { formKey := "inputs[" + key + "]" - return ctx.FormString(formKey) + return ctx.Req.PostFormValue(formKey) } if err := workflow.Dispatch(ctx, formKeyGetter, ctx.Repo.Repository, ctx.Doer); err != nil { diff --git a/templates/repo/actions/dispatch.tmpl b/templates/repo/actions/dispatch.tmpl index 2372e61ebb..48c2aa5a26 100644 --- a/templates/repo/actions/dispatch.tmpl +++ b/templates/repo/actions/dispatch.tmpl @@ -33,7 +33,9 @@ {{if eq $val.Type "boolean"}}
- + {{/* These two inputs need to stay in exactly this order (checkbox first, hidden second) or boolean fields wont work correctly! */}} + +
{{else}}