mirror of
https://github.com/go-gitea/gitea
synced 2024-11-21 18:22:13 +01:00
Refactor workflow dispatch
Signed-off-by: Bence Santha <git@santha.eu>
This commit is contained in:
parent
0357003ddf
commit
1969e6b4ad
1 changed files with 5 additions and 6 deletions
|
@ -194,20 +194,19 @@ func DispatchActionWorkflow(ctx *context.APIContext, workflowID string, opt *api
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
workflows, err := jobparser.Parse(content)
|
workflows, err := jobparser.Parse(content)
|
||||||
if err != nil || len(workflows) == 0 {
|
if err != nil {
|
||||||
ctx.Error(http.StatusInternalServerError, "WorkflowParseError", err.Error())
|
ctx.Error(http.StatusInternalServerError, "WorkflowParseError", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if len(workflows) == 0 {
|
||||||
|
ctx.Error(http.StatusNotFound, "WorkflowNotFound", fmt.Sprintf("workflow '%s' is not found", workflowID))
|
||||||
|
return
|
||||||
|
}
|
||||||
workflow = workflows[0]
|
workflow = workflows[0]
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if workflow == nil {
|
|
||||||
ctx.Error(http.StatusNotFound, "WorkflowNotFound", fmt.Sprintf("workflow '%s' is not found", workflowID))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Process workflow inputs
|
// Process workflow inputs
|
||||||
inputs := processWorkflowInputs(opt, &model.Workflow{
|
inputs := processWorkflowInputs(opt, &model.Workflow{
|
||||||
RawOn: workflow.RawOn,
|
RawOn: workflow.RawOn,
|
||||||
|
|
Loading…
Reference in a new issue