1
0
Fork 0
mirror of https://github.com/vbatts/git-validation.git synced 2024-12-29 08:46:31 +00:00

Merge pull request #29 from vbatts/fix_push_ci

travis: only run the git-validation on pull-requests
This commit is contained in:
Vincent Batts 2017-04-27 14:04:18 -04:00 committed by GitHub
commit ac0930a271
2 changed files with 15 additions and 8 deletions

View file

@ -11,6 +11,7 @@ before_install:
- mkdir -p $GOPATH/src/github.com/vbatts && ln -sf $(pwd) $GOPATH/src/github.com/vbatts/git-validation && go get ./... - mkdir -p $GOPATH/src/github.com/vbatts && ln -sf $(pwd) $GOPATH/src/github.com/vbatts/git-validation && go get ./...
before_script: before_script:
- env
- echo $TRAVIS_COMMIT_RANGE - echo $TRAVIS_COMMIT_RANGE
- echo $TRAVIS_COMMIT - echo $TRAVIS_COMMIT
- echo $TRAVIS_BRANCH - echo $TRAVIS_BRANCH

View file

@ -22,6 +22,7 @@ var (
flQuiet = flag.Bool("q", false, "less output") flQuiet = flag.Bool("q", false, "less output")
flDir = flag.String("d", ".", "git directory to validate from") flDir = flag.String("d", ".", "git directory to validate from")
flNoTravis = flag.Bool("no-travis", false, "disables travis environment checks (when env TRAVIS=true is set)") flNoTravis = flag.Bool("no-travis", false, "disables travis environment checks (when env TRAVIS=true is set)")
flTravisPROnly = flag.Bool("travis-pr-only", true, "when on travis, only run validations if the CI-Build is checking pull-request build")
) )
func main() { func main() {
@ -41,6 +42,11 @@ func main() {
return return
} }
if *flTravisPROnly && strings.ToLower(os.Getenv("TRAVIS_PULL_REQUEST")) == "false" {
fmt.Printf("only to check travis PR builds and this not a PR build. yielding.\n")
return
}
// reduce the set being run // reduce the set being run
rules := validate.RegisteredRules rules := validate.RegisteredRules
if *flRun != "" { if *flRun != "" {