mirror of
https://gitea.com/gitea/act_runner.git
synced 2026-03-20 11:56:47 +08:00
feat: --validate and --strict (#71)
* feat: `--validate` and `--strict` * add test for strict validate
This commit is contained in:
@@ -66,6 +66,8 @@ func createRootCommand(ctx context.Context, input *Input, version string) *cobra
|
||||
}
|
||||
|
||||
rootCmd.Flags().BoolP("watch", "w", false, "watch the contents of the local repo and run when files change")
|
||||
rootCmd.Flags().BoolVar(&input.validate, "validate", false, "validate workflows")
|
||||
rootCmd.Flags().BoolVar(&input.strict, "strict", false, "use strict workflow schema")
|
||||
rootCmd.Flags().BoolP("list", "l", false, "list workflows")
|
||||
rootCmd.Flags().BoolP("graph", "g", false, "draw workflows")
|
||||
rootCmd.Flags().StringP("job", "j", "", "run a specific job ID")
|
||||
@@ -448,7 +450,7 @@ func newRunCommand(ctx context.Context, input *Input) func(*cobra.Command, []str
|
||||
matrixes := parseMatrix(input.matrix)
|
||||
log.Debugf("Evaluated matrix inclusions: %v", matrixes)
|
||||
|
||||
planner, err := model.NewWorkflowPlanner(input.WorkflowsPath(), !input.workflowRecurse)
|
||||
planner, err := model.NewWorkflowPlanner(input.WorkflowsPath(), !input.workflowRecurse, input.strict)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -464,6 +466,11 @@ func newRunCommand(ctx context.Context, input *Input) func(*cobra.Command, []str
|
||||
return err
|
||||
}
|
||||
|
||||
// check if we should just validate the workflows
|
||||
if input.validate {
|
||||
return err
|
||||
}
|
||||
|
||||
// check if we should just draw the graph
|
||||
graph, err := cmd.Flags().GetBool("graph")
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user