enhance: Improve validation errors for secrets/variables (#39221)

Signed-off-by: Ross Golder <ross@golder.org>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Ross Golder
2026-09-04 00:28:58 +00:00
committed by GitHub
co-authored by wxiaoguang
parent ce2fd8d882
commit 2d3ad4a530
19 changed files with 148 additions and 218 deletions
+3 -5
View File
@@ -126,8 +126,7 @@ func VariableCreate(ctx *context.Context) {
v, err := actions_service.CreateVariable(ctx, vCtx.OwnerID, vCtx.RepoID, form.Name, form.Data, form.Description)
if err != nil {
log.Error("CreateVariable: %v", err)
ctx.JSONError(ctx.Tr("actions.variables.creation.failed"))
ctx.JSONErrorAuto(err)
return
}
@@ -159,9 +158,8 @@ func VariableUpdate(ctx *context.Context) {
variable.Data = form.Data
variable.Description = form.Description
if ok, err := actions_service.UpdateVariableNameData(ctx, variable); err != nil || !ok {
log.Error("UpdateVariable: %v", err)
ctx.JSONError(ctx.Tr("actions.variables.update.failed"))
if _, err := actions_service.UpdateVariableNameData(ctx, variable); err != nil {
ctx.JSONErrorAuto(err)
return
}
ctx.Flash.Success(ctx.Tr("actions.variables.update.success"))