mirror of
https://github.com/vbatts/git-validation.git
synced 2024-12-28 08:16:31 +00:00
travis: only run the git-validation on pull-requests
Fixes #24 https://docs.travis-ci.com/user/pull-requests/ Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
e6a550d472
commit
56ef622e37
2 changed files with 15 additions and 8 deletions
|
@ -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 ./...
|
||||
|
||||
before_script:
|
||||
- env
|
||||
- echo $TRAVIS_COMMIT_RANGE
|
||||
- echo $TRAVIS_COMMIT
|
||||
- echo $TRAVIS_BRANCH
|
||||
|
|
6
main.go
6
main.go
|
@ -22,6 +22,7 @@ var (
|
|||
flQuiet = flag.Bool("q", false, "less output")
|
||||
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)")
|
||||
flTravisPROnly = flag.Bool("travis-pr-only", true, "when on travis, only run validations if the CI-Build is checking pull-request build")
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -41,6 +42,11 @@ func main() {
|
|||
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
|
||||
rules := validate.RegisteredRules
|
||||
if *flRun != "" {
|
||||
|
|
Loading…
Reference in a new issue