Skip to content

Commit 39f784e

Browse files
committed
chore: test commits in pr via Travis CI (#37)
* chore: delete obsolete test file * chore: lint commits in a pr * chore: enable clone pr linting * chore: remove rogue npmrc * chore: add missing devDependency
1 parent cc6098c commit 39f784e

File tree

5 files changed

+22
-10
lines changed

5 files changed

+22
-10
lines changed

packages/conventional-changelog-lint/.conventional-changelog-lintrc

-5
This file was deleted.

packages/conventional-changelog-lint/.npmrc

-4
This file was deleted.

packages/conventional-changelog-lint/.travis.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ node_js:
44
- '6'
55
- '4'
66
before_install:
7-
- npm i -g npm
7+
- git fetch --unshallow
88
before_script:
9+
- npm run lint:prcommits
910
- npm run build
1011
script:
1112
- npm test

packages/conventional-changelog-lint/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"pretest": "npm run deps",
2222
"test": "ava",
2323
"lint": "xo *.js",
24+
"lint:prcommits": "./scripts/lint-prcommits.sh",
2425
"deps": "npm run build && dependency-check . --missing && dependency-check . --extra --no-dev -i conventional-changelog-angular -i conventional-changelog-lint-config-angular",
2526
"commitlint": "node distribution/cli.js --from=HEAD~1",
2627
"preversion": "npm run build && npm test",
@@ -95,6 +96,7 @@
9596
"babel-polyfill": "6.20.0",
9697
"babel-preset-env": "1.2.1",
9798
"babel-preset-stage-0": "6.16.0",
99+
"babel-register": "6.24.1",
98100
"conventional-changelog-cli": "1.2.0",
99101
"conventional-recommended-bump": "0.3.0",
100102
"cz-conventional-changelog-lint": "0.1.3",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
set -e
3+
set -u
4+
5+
# 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
7+
git remote add "$TRAVIS_PULL_REQUEST_SLUG" "https://github.com/$TRAVIS_PULL_REQUEST_SLUG.git"
8+
git fetch "$TRAVIS_PULL_REQUEST_SLUG"
9+
fi
10+
11+
# Use REMOTE/BRANCH as comparison if applicable
12+
if [ $TRAVIS_PULL_REQUEST_SLUG != "" ]; then
13+
TO="$TRAVIS_PULL_REQUEST_SLUG/$TRAVIS_PULL_REQUEST_BRANCH"
14+
else
15+
TO="$TRAVIS_PULL_REQUEST_BRANCH"
16+
fi
17+
18+
conventional-changelog-lint --from="$TRAVIS_BRANCH" --to="$TO"

0 commit comments

Comments
 (0)