Skip to content

Commit 3279170

Browse files
committed
chore: solidify lint-prcommits
1 parent 39f784e commit 3279170

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

packages/conventional-changelog-lint/scripts/lint-prcommits.sh

+7-3
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,20 @@ set -e
33
set -u
44

55
# Add the clone as remote if this is a PR from a clone
6-
if [ $TRAVIS_PULL_REQUEST_SLUG != "" ] && [ $TRAVIS_PULL_REQUEST_SLUG != $TRAVIS_REPO_SLUG ]; then
6+
if [[ $TRAVIS_PULL_REQUEST_SLUG != "" && $TRAVIS_PULL_REQUEST_SLUG != $TRAVIS_REPO_SLUG ]]; then
77
git remote add "$TRAVIS_PULL_REQUEST_SLUG" "https://github.com/$TRAVIS_PULL_REQUEST_SLUG.git"
88
git fetch "$TRAVIS_PULL_REQUEST_SLUG"
99
fi
1010

1111
# Use REMOTE/BRANCH as comparison if applicable
12-
if [ $TRAVIS_PULL_REQUEST_SLUG != "" ]; then
12+
if [[ $TRAVIS_PULL_REQUEST_SLUG != "" ]]; then
1313
TO="$TRAVIS_PULL_REQUEST_SLUG/$TRAVIS_PULL_REQUEST_BRANCH"
1414
else
1515
TO="$TRAVIS_PULL_REQUEST_BRANCH"
1616
fi
1717

18-
conventional-changelog-lint --from="$TRAVIS_BRANCH" --to="$TO"
18+
if [[ $TRAVIS_BRANCH == $TO ]]; then
19+
conventional-changelog-lint --from="HEAD~1"
20+
else
21+
conventional-changelog-lint --from="$TRAVIS_BRANCH" --to="$TO"
22+
fi

0 commit comments

Comments
 (0)