Skip to content

Commit

Permalink
Merge pull request #6 from joaquin-corchero/master
Browse files Browse the repository at this point in the history
Added options for filtering messages
This closes #5
  • Loading branch information
alexcanessa committed Mar 3, 2016
2 parents fd6aa10 + 57023dd commit 29bae75
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ There are optional arguments such as:

- `--draft=true` To set the release as a draft. Default: `false`
- `--prerelease=true` To set the release as a prerelease. Default: `false`
- `--prefix=v` Add a prefix to the tag version `e.g. v1.0.1`
- `--prefix=v` Add a prefix to the tag version `e.g. v1.0.1`
- `--includemessages=merges/commits/all` used to filter the messages added to the release notes. Default: `commits`
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "github-release-notes",
"version": "0.3.3",
"version": "0.4.0",
"description": "Node module to publish release notes based on commits between the last two tags.",
"main": "./github-release-notes.js",
"scripts": {
Expand Down
13 changes: 11 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,19 @@ function prepareRelease(gren, tagName, commitMessages) {
var body = commitMessages
.slice(0, -1)
.filter(function (message) {
return !message.match(/^merge/i);
switch(gren.includemessages)
{
case 'merges':
return message.match(/^merge/i);
case "all":
return true;
default:
return !message.match(/^merge/i);
}
})
.map(createBody)
.join('\n');

var releaseOptions = {
tag_name: tagName,
name: (gren.options.prefix || '') + tagName,
Expand Down Expand Up @@ -212,6 +220,7 @@ function GithubReleaseNotes(options) {
auth: 'oauth'
});

this.includemessages = this.options.includemessages || "commits";
this.repo = github.getRepo(this.options.username, this.options.repo);
}

Expand Down

0 comments on commit 29bae75

Please sign in to comment.