Skip to content

Commit ac027ae

Browse files
committed
chore(travis): add commitplease validation to ci-checks
This will provide feedback to contributors without getting in the way of writing invalid commit messages locally. The git hook integration is turned off. Committers who push directly to the repo can be expected to use correct commit messages ;) Most changes go through PRs anyway. Note that "Merge commit" messages and everything starting with "WIP" is always allowed by commitplease. Follow issue jzaefferer/commitplease#101 for more info. Related to angular#14888 Closes angular#16097
1 parent 8d38e1a commit ac027ae

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

package.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"changez-angular": "^2.1.2",
3131
"cheerio": "^0.17.0",
3232
"commitizen": "^2.3.0",
33+
"commitplease": "^2.7.10",
3334
"cross-spawn": "^4.0.0",
3435
"cz-conventional-changelog": "1.1.4",
3536
"dgeni": "^0.4.0",
@@ -94,9 +95,13 @@
9495
"stringmap": "^0.2.2"
9596
},
9697
"dependencies": {},
98+
"commitplease": {
99+
"style": "angular",
100+
"nohook": true
101+
},
97102
"config": {
98103
"commitizen": {
99104
"path": "node_modules/cz-conventional-changelog"
100105
}
101106
}
102-
}
107+
}

scripts/travis/build.sh

+7
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ export SAUCE_ACCESS_KEY=`echo $SAUCE_ACCESS_KEY | rev`
77

88
if [ "$JOB" == "ci-checks" ]; then
99
grunt ci-checks
10+
if [[ $TRAVIS_PULL_REQUEST != 'false' ]]; then
11+
# validate commit messages of all commits in the PR
12+
# convert commit range to 2 dots, as commitplease uses `git log`.
13+
# See https://github.com/travis-ci/travis-ci/issues/4596 for more info
14+
echo "Validate commit messages in PR."
15+
yarn run commitplease -- "${TRAVIS_COMMIT_RANGE/.../..}"
16+
fi
1017
elif [ "$JOB" == "unit" ]; then
1118
if [ "$BROWSER_PROVIDER" == "browserstack" ]; then
1219
BROWSERS="BS_Chrome,BS_Safari,BS_Firefox,BS_IE_9,BS_IE_10,BS_IE_11,BS_iOS"

yarn.lock

+20
Original file line numberDiff line numberDiff line change
@@ -1166,6 +1166,16 @@ commitizen@^2.3.0:
11661166
shelljs "0.7.5"
11671167
strip-json-comments "2.0.1"
11681168

1169+
commitplease@^2.7.10:
1170+
version "2.7.10"
1171+
resolved "https://registry.yarnpkg.com/commitplease/-/commitplease-2.7.10.tgz#129af5abb365b46f25e652020c5d1548c947f163"
1172+
dependencies:
1173+
chalk "^1.1.1"
1174+
git-tools "^0.2.1"
1175+
ini "^1.3.4"
1176+
object-assign "^4.1.0"
1177+
semver "^5.1.0"
1178+
11691179
11701180
version "0.0.1"
11711181
resolved "https://registry.yarnpkg.com/commondir/-/commondir-0.0.1.tgz#89f00fdcd51b519c578733fec563e6a6da7f5be2"
@@ -2475,6 +2485,12 @@ getpass@^0.1.1:
24752485
dependencies:
24762486
assert-plus "^1.0.0"
24772487

2488+
git-tools@^0.2.1:
2489+
version "0.2.1"
2490+
resolved "https://registry.yarnpkg.com/git-tools/-/git-tools-0.2.1.tgz#6e1846af2c0e91ab59258b48f9b53c1279b3b273"
2491+
dependencies:
2492+
spawnback "~1.0.0"
2493+
24782494
glob-base@^0.3.0:
24792495
version "0.3.0"
24802496
resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4"
@@ -5906,6 +5922,10 @@ spawn-sync@^1.0.15:
59065922
concat-stream "^1.4.7"
59075923
os-shim "^0.1.2"
59085924

5925+
spawnback@~1.0.0:
5926+
version "1.0.0"
5927+
resolved "https://registry.yarnpkg.com/spawnback/-/spawnback-1.0.0.tgz#f73662f7e54d95367eca74d6426c677dd7ea686f"
5928+
59095929
spdx-correct@~1.0.0:
59105930
version "1.0.2"
59115931
resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-1.0.2.tgz#4b3073d933ff51f3912f03ac5519498a4150db40"

0 commit comments

Comments
 (0)