Skip to content

Commit

Permalink
Merge branch 'main' of github.com:go-vela/server into enhance/deleteE…
Browse files Browse the repository at this point in the history
…vent
  • Loading branch information
Claire.Nicholas authored and Claire.Nicholas committed Jan 18, 2024
2 parents 8e0b050 + d79d3a5 commit 3861822
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/validate-pr-title.yml
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 0 additions & 6 deletions compiler/native/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
8 changes: 4 additions & 4 deletions compiler/native/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand All @@ -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" {
Expand Down

0 comments on commit 3861822

Please sign in to comment.