Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Manage grouped issues with multiple labels #130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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