diff --git a/.github/workflows/validate-pr-title.yml b/.github/workflows/validate-pr-title.yml new file mode 100644 index 000000000..462f9be92 --- /dev/null +++ b/.github/workflows/validate-pr-title.yml @@ -0,0 +1,17 @@ +# name of the action +name: validate PR title + +# trigger on pull_request events of the opened & edited type. +on: + pull_request: + types: [opened, synchronize, edited, reopened] + +# pipeline to execute +jobs: + validate: + runs-on: ubuntu-latest + + steps: + - name: validate title + run: | + echo "${{ github.event.pull_request.title }}" | grep -Eq '^(feat|fix|chore|refactor|enhance|test|docs)(\(.*\)|):\s.+$' && (echo "Pass"; exit 0) || (echo "Incorrect Format. Please see https://go-vela.github.io/docs/community/contributing_guidelines/#development-workflow"; exit 1) diff --git a/compiler/native/compile.go b/compiler/native/compile.go index b0648ded0..206124519 100644 --- a/compiler/native/compile.go +++ b/compiler/native/compile.go @@ -50,12 +50,6 @@ func (c *client) Compile(v interface{}) (*pipeline.Build, *library.Pipeline, err _pipeline.SetData(data) _pipeline.SetType(c.repo.GetPipelineType()) - // validate the yaml configuration - err = c.Validate(p) - if err != nil { - return nil, _pipeline, err - } - // create map of templates for easy lookup templates := mapFromTemplates(p.Templates) diff --git a/compiler/native/validate.go b/compiler/native/validate.go index 1d5b0440b..e3c79d862 100644 --- a/compiler/native/validate.go +++ b/compiler/native/validate.go @@ -101,8 +101,8 @@ func validateStages(s yaml.StageSlice) error { return fmt.Errorf("no name provided for step for stage %s", stage.Name) } - if len(step.Image) == 0 && len(step.Template.Name) == 0 { - return fmt.Errorf("no image or template provided for step %s for stage %s", step.Name, stage.Name) + if len(step.Image) == 0 { + return fmt.Errorf("no image provided for step %s for stage %s", step.Name, stage.Name) } if step.Name == "clone" || step.Name == "init" { @@ -128,8 +128,8 @@ func validateSteps(s yaml.StepSlice) error { return fmt.Errorf("no name provided for step") } - if len(step.Image) == 0 && len(step.Template.Name) == 0 { - return fmt.Errorf("no image or template provided for step %s", step.Name) + if len(step.Image) == 0 { + return fmt.Errorf("no image provided for step %s", step.Name) } if step.Name == "clone" || step.Name == "init" {