Skip to content

Commit 64346dc

Browse files
committed
fix lint
1 parent 828cc17 commit 64346dc

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

routers/web/repo/actions/actions.go

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,17 @@ func List(ctx *context.Context) {
7171
ctx.ServerError("GetBranchCommit", err)
7272
return
7373
}
74+
7475
workflows := prepareWorkflowDispatchTemplate(ctx, commit)
76+
if ctx.Written() {
77+
return
78+
}
79+
7580
prepareWorkflowList(ctx, workflows)
81+
if ctx.Written() {
82+
return
83+
}
84+
7685
ctx.HTML(http.StatusOK, tplListActions)
7786
}
7887

@@ -99,6 +108,9 @@ func WorkflowDispatchInputs(ctx *context.Context) {
99108
return
100109
}
101110
prepareWorkflowDispatchTemplate(ctx, commit)
111+
if ctx.Written() {
112+
return
113+
}
102114
ctx.HTML(http.StatusOK, tplDispatchInputsActions)
103115
}
104116

@@ -112,7 +124,7 @@ func prepareWorkflowDispatchTemplate(ctx *context.Context, commit *git.Commit) (
112124
entries, err := actions.ListWorkflows(commit)
113125
if err != nil {
114126
ctx.ServerError("ListWorkflows", err)
115-
return
127+
return nil
116128
}
117129

118130
// Get all runner labels
@@ -123,7 +135,7 @@ func prepareWorkflowDispatchTemplate(ctx *context.Context, commit *git.Commit) (
123135
})
124136
if err != nil {
125137
ctx.ServerError("FindRunners", err)
126-
return
138+
return nil
127139
}
128140
allRunnerLabels := make(container.Set[string])
129141
for _, r := range runners {
@@ -136,7 +148,7 @@ func prepareWorkflowDispatchTemplate(ctx *context.Context, commit *git.Commit) (
136148
content, err := actions.GetContentFromEntry(entry)
137149
if err != nil {
138150
ctx.ServerError("GetContentFromEntry", err)
139-
return
151+
return nil
140152
}
141153
wf, err := model.ReadWorkflow(bytes.NewReader(content))
142154
if err != nil {
@@ -213,7 +225,7 @@ func prepareWorkflowDispatchTemplate(ctx *context.Context, commit *git.Commit) (
213225
branches, err := git_model.FindBranchNames(ctx, branchOpts)
214226
if err != nil {
215227
ctx.ServerError("FindBranchNames", err)
216-
return
228+
return nil
217229
}
218230
// always put default branch on the top if it exists
219231
if slices.Contains(branches, ctx.Repo.Repository.DefaultBranch) {
@@ -225,7 +237,7 @@ func prepareWorkflowDispatchTemplate(ctx *context.Context, commit *git.Commit) (
225237
tags, err := repo_model.GetTagNamesByRepoID(ctx, ctx.Repo.Repository.ID)
226238
if err != nil {
227239
ctx.ServerError("GetTagNamesByRepoID", err)
228-
return
240+
return nil
229241
}
230242
ctx.Data["Tags"] = tags
231243
}

templates/repo/actions/workflow_dispatch_inputs.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{if not .WorkflowDispatchConfig}}
2-
<div class="ui red message">
2+
<div class="ui error message">
33
{{/* TODO: Technically this error is also shown if no workflow_dispatch is defined. However we need to know if the workflow exist like in #33098 (comment) to render a different error text.
44
A: does the newly added "CurWorkflowExists" help? */}}
55
{{ctx.Locale.Tr "actions.workflow.not_found" $.CurWorkflow}}

0 commit comments

Comments
 (0)