Skip to content
This repository has been archived by the owner on Feb 10, 2020. It is now read-only.

packsaddle/example-travis_ci-pull_request_review-jscs

Repository files navigation

example-travis_ci-pull_request_review-jscs

run jscs and pull request review comment

Actual script for TravisCI

# .travis.yml
before_script: ./bin/run-jscs.sh

# bin/run-jscs.sh
#!/bin/bash
set -v
if [ -n "${TRAVIS_PULL_REQUEST}" ] && [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
  gem install --no-document checkstyle_filter-git saddler saddler-reporter-github

  git diff --name-only origin/master \
   | grep '.*\.js$' \
   | xargs ./node_modules/gulp-jscs/node_modules/.bin/jscs \
       --reporter checkstyle \
   | checkstyle_filter-git diff origin/master \
   | saddler report \
      --require saddler/reporter/github \
      --reporter Saddler::Reporter::Github::PullRequestReviewComment
fi

exit 0

If you prefer to exec after_script, you can set this. see: Travis CI: Configuring your build

Setting

Travis CI: Encryption keys

$ gem install travis
$ travis encrypt -r <owner_name>/<repos_name> "GITHUB_ACCESS_TOKEN=<github_token>"

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using gulp.

License

Copyright (c) 2015 sanemat. Licensed under the MIT license.