Skip to content

Commit

Permalink
Merge pull request ReactiveX#2349 from kwonoj/chore-danger-changelog
Browse files Browse the repository at this point in the history
chore(danger): update dangerfile to validate commit message
  • Loading branch information
jayphelps authored Feb 14, 2017
2 parents 71704b2 + 25d3f4a commit d23add0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions dangerfile.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var fs = require('fs');
var path = require('path');
var _ = require('lodash');
var validateMessage = require('validate-commit-msg');

//simple regex matcher to detect usage of helper function and its type signature
var hotMatch = /\bhot\(/gi;
Expand Down Expand Up @@ -53,4 +54,15 @@ var testFilesMissingTypes = modifiedSpecFiles.reduce(function (acc, value) {
if (testFilesMissingTypes.length > 0) {
fail('missing type definition import in tests (' + testFilesMissingTypes + ') (' + ++errorCount + ')');
markdown('> (' + errorCount + ') : It seems updated test cases uses test scheduler interface `hot`, `cold` but miss to import type signature for those.');
}

//validate commit message in PR if it conforms conventional change log, notify if it doesn't.
var messageConventionValid = danger.git.commits.reduce(function (acc, value) {
var valid = validateMessage(value.message);
return valid && acc;
}, true);

if (!messageConventionValid) {
fail('commit message does not follows conventional change log (' + ++errorCount + ')');
markdown('> (' + errorCount + ') : RxJS uses conventional change log to generate changelog automatically. It seems some of commit messages are not following those, please check [contributing guideline](https://github.com/ReactiveX/rxjs/blob/master/CONTRIBUTING.md#commit-message-format) and update commit messages.');
}

0 comments on commit d23add0

Please sign in to comment.