gulp-github
A gulp plugin to comment jscs/jshint/eslint issues to a github pull request.
Features
- See your CI issues of lint tools on github!
- Collect gulp-jshint results.
- Collect gulp-jscs results.
- Collect gulp-eslint results.
- Write collected info then comment on a github pull request.
- Update github pull request status based on collected info.
- A failThisTask() reporter to fail a gulp task when jscs/jshint/eslint issues found
- TODO Collect lcov result.
Installation
npm install gulp-github
Usage
var gulp = require('gulp'),
jshint = require('gulp-jshint'),
jscs = require('gulp-jscs'),
eslint = require('gulp-eslint'),
github = require('gulp-github');
gulp.task('lint_report_github', function () {
return gulp.src('lib/*.js')
.pipe(jshint())
.pipe(jscs()).on('error', function (E) {
console.log(E.message);
})
.pipe(eslint())
.pipe(github(options))
.pipe(github.failThisTask());
});
github.commentToPR('Yes! it works!!', options);
github.createStatusToCommit({
description: 'No! 2 failures...',
context: 'my gulp task',
state: 'failure',
target_url: 'http://www.homerswebpage.com/'
}, options);
gulp.task('git_rules', function (cb) {
git.failMergedPR(options, cb);
});
Options
{
git_token: 'your_github_oauth_token',
git_repo: 'zordius/test',
git_prid: '1',
git_sha: 00000000,
jshint_status: 'error',
jscs_status: 'failure',
eslint_status: 'error',
git_option: {
host: 'github.mycorp.com',
pathPrefix: '/api/v3'
},
jshint_reporter: function (E, file) {
return 'Error in ' + E.file + '!';
},
jscs_reporter: function (E, file) {
return 'Error in ' + E.filename + '!';
}
}
Check this sample gulpfile to see how to migrate this with travis CI.
Check This PR to see live demo.