diff --git a/package.json b/package.json index 8c710e67fc7d..767716f9f0db 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "changez-angular": "^2.1.2", "cheerio": "^0.17.0", "commitizen": "^2.3.0", + "commitplease": "^2.7.10", "cross-spawn": "^4.0.0", "cz-conventional-changelog": "1.1.4", "dgeni": "^0.4.0", @@ -95,9 +96,13 @@ "stringmap": "^0.2.2" }, "dependencies": {}, + "commitplease": { + "style": "angular", + "nohook": true + }, "config": { "commitizen": { "path": "node_modules/cz-conventional-changelog" } } -} +} \ No newline at end of file diff --git a/scripts/travis/build.sh b/scripts/travis/build.sh index 0ecfc25daf5f..bf9be1724550 100755 --- a/scripts/travis/build.sh +++ b/scripts/travis/build.sh @@ -7,6 +7,13 @@ export SAUCE_ACCESS_KEY=`echo $SAUCE_ACCESS_KEY | rev` if [ "$JOB" == "ci-checks" ]; then grunt ci-checks + if [[ $TRAVIS_PULL_REQUEST != 'false' ]]; then + # validate commit messages of all commits in the PR + # convert commit range to 2 dots, as commitplease uses `git log`. + # See https://github.com/travis-ci/travis-ci/issues/4596 for more info + echo "Validate commit messages in PR." + yarn run commitplease -- "${TRAVIS_COMMIT_RANGE/.../..}" + fi elif [ "$JOB" == "unit" ]; then if [ "$BROWSER_PROVIDER" == "browserstack" ]; then BROWSERS="BS_Chrome,BS_Safari,BS_Firefox,BS_IE_9,BS_IE_10,BS_IE_11,BS_EDGE,BS_iOS_8,BS_iOS_9" diff --git a/yarn.lock b/yarn.lock index 46d99a35381b..54e17f12a7db 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1166,6 +1166,16 @@ commitizen@^2.3.0: shelljs "0.7.5" strip-json-comments "2.0.1" +commitplease@^2.7.10: + version "2.7.10" + resolved "https://registry.yarnpkg.com/commitplease/-/commitplease-2.7.10.tgz#129af5abb365b46f25e652020c5d1548c947f163" + dependencies: + chalk "^1.1.1" + git-tools "^0.2.1" + ini "^1.3.4" + object-assign "^4.1.0" + semver "^5.1.0" + commondir@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/commondir/-/commondir-0.0.1.tgz#89f00fdcd51b519c578733fec563e6a6da7f5be2" @@ -2475,6 +2485,12 @@ getpass@^0.1.1: dependencies: assert-plus "^1.0.0" +git-tools@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/git-tools/-/git-tools-0.2.1.tgz#6e1846af2c0e91ab59258b48f9b53c1279b3b273" + dependencies: + spawnback "~1.0.0" + glob-base@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4" @@ -5912,6 +5928,10 @@ spawn-sync@^1.0.15: concat-stream "^1.4.7" os-shim "^0.1.2" +spawnback@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/spawnback/-/spawnback-1.0.0.tgz#f73662f7e54d95367eca74d6426c677dd7ea686f" + spdx-correct@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-1.0.2.tgz#4b3073d933ff51f3912f03ac5519498a4150db40"