From 36bd9a98d7e429e106c4ef269515992800c3651a Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 17 Oct 2018 19:17:06 -0700 Subject: [PATCH] tools: do not lint commit message if var undefined Check that $TRAVIS_COMMIT_RANGE is set before trying to lint commit messages in Travis CI. Refs: https://github.com/nodejs/node/pull/23572#issuecomment-430850382 Refs: https://github.com/nodejs/node/pull/22842#issuecomment-430850049 PR-URL: https://github.com/nodejs/node/pull/23725 Reviewed-By: Anatoli Papirovski Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Matheus Marchini --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index fad2e7f0c77509..156d28298b4e58 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ matrix: script: - make lint # Lint the first commit in the PR. - - git log $TRAVIS_COMMIT_RANGE --pretty=format:'%h' --no-merges | tail -1 | xargs npx core-validate-commit --no-validate-metadata + - \[ -z "$TRAVIS_COMMIT_RANGE" \] || git log $TRAVIS_COMMIT_RANGE --pretty=format:'%h' --no-merges | tail -1 | xargs npx core-validate-commit --no-validate-metadata - name: "Test Suite" install: - ./configure