Skip to content

Commit

Permalink
chore: test commits in pr via Travis CI (#37)
Browse files Browse the repository at this point in the history
* chore: delete obsolete test file

* chore: lint commits in a pr

* chore: enable clone pr linting

* chore: remove rogue npmrc

* chore: add missing devDependency
  • Loading branch information
marionebl authored May 3, 2017
1 parent 05b4427 commit 627b3f3
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 10 deletions.
5 changes: 0 additions & 5 deletions .conventional-changelog-lintrc

This file was deleted.

4 changes: 0 additions & 4 deletions .npmrc

This file was deleted.

3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ node_js:
- '6'
- '4'
before_install:
- npm i -g npm
- git fetch --unshallow
before_script:
- npm run lint:prcommits
- npm run build
script:
- npm test
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"pretest": "npm run deps",
"test": "ava",
"lint": "xo *.js",
"lint:prcommits": "./scripts/lint-prcommits.sh",
"deps": "npm run build && dependency-check . --missing && dependency-check . --extra --no-dev -i conventional-changelog-angular -i conventional-changelog-lint-config-angular",
"commitlint": "node distribution/cli.js --from=HEAD~1",
"preversion": "npm run build && npm test",
Expand Down Expand Up @@ -95,6 +96,7 @@
"babel-polyfill": "6.20.0",
"babel-preset-env": "1.2.1",
"babel-preset-stage-0": "6.16.0",
"babel-register": "6.24.1",
"conventional-changelog-cli": "1.2.0",
"conventional-recommended-bump": "0.3.0",
"cz-conventional-changelog-lint": "0.1.3",
Expand Down
18 changes: 18 additions & 0 deletions scripts/lint-prcommits.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
set -e
set -u

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

# Use REMOTE/BRANCH as comparison if applicable
if [ $TRAVIS_PULL_REQUEST_SLUG != "" ]; then
TO="$TRAVIS_PULL_REQUEST_SLUG/$TRAVIS_PULL_REQUEST_BRANCH"
else
TO="$TRAVIS_PULL_REQUEST_BRANCH"
fi

conventional-changelog-lint --from="$TRAVIS_BRANCH" --to="$TO"

0 comments on commit 627b3f3

Please sign in to comment.