Skip to content

Commit

Permalink
Manage grouped issues with multiple labels (#130)
Browse files Browse the repository at this point in the history
* Manage issues with multiple labels

* Add documentation for group issues with multiple labels
  • Loading branch information
alexcanessa authored Jan 19, 2018
1 parent 2c8888c commit c93f772
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions docs/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ Via the configuration file you can have more complex grouping, using labels in a

In this case `gren` will group all the issues labeled with `enhancement` and `internal` under the title _"Enhancements: "_ and all the ones with `bug` under the title _"Bug Fixes: "_.

#### Issues with multiple labels

In case an issue has more than a specified label (e.g. both "enhancement" and "bug"), `gren` will prioritise based on the order (i.e. the issue will only appear in the "Enhancements" group).

### Extensions

The accepted file extensions are the following:
Expand Down
4 changes: 2 additions & 2 deletions lib/src/Gren.js
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ class Gren {
}

const allLabels = Object.values(groupBy).reduce((carry, group) => carry.concat(group), []);
const groups = Object.keys(groupBy).reduce((carry, group) => {
const groups = Object.keys(groupBy).reduce((carry, group, i, arr) => {
const groupIssues = issues.filter(issue => {
if (!issue.labels.length && this.options.template.noLabel) {
issue.labels.push({name: this.options.template.noLabel});
Expand All @@ -758,7 +758,7 @@ class Gren {
const isOtherLabel = groupBy[group].indexOf('...') !== -1 && allLabels.indexOf(label.name) === -1;

return groupBy[group].indexOf(label.name) !== -1 || isOtherLabel;
});
}) && !arr.filter(title => carry[title]).some(title => carry[title].indexOf(this._templateIssue(issue)) !== -1);
}).map(this._templateIssue.bind(this));

if (groupIssues.length) {
Expand Down

0 comments on commit c93f772

Please sign in to comment.