Add travis check for the base branch (only permit develop for code changes)

This commit is contained in:
Albin Larsson 2018-07-10 03:52:02 +02:00
parent 6fd4389887
commit 82a119c67f
2 changed files with 6 additions and 0 deletions

View File

@ -2,6 +2,7 @@ language: node_js
node_js: lts/*
script:
- bash .travis/prevent-base-master.sh
- bash .travis/omit-dist.sh
- npm run lint
- npm run build

5
.travis/prevent-base-master.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
if [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ $TRAVIS_BRANCH == "master" ] && $(git diff --name-only $TRAVIS_COMMIT_RANGE | grep -q "^src/"); then
echo 'The base branch for pull requests must be "develop"' >&2
exit 1
fi