Skip to content
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

Reduce duplicate references in conventional-changelog-conventionalcommits #926

Open
creage opened this issue Jun 17, 2022 · 0 comments · May be fixed by #939
Open

Reduce duplicate references in conventional-changelog-conventionalcommits #926

creage opened this issue Jun 17, 2022 · 0 comments · May be fixed by #939

Comments

@creage
Copy link

creage commented Jun 17, 2022

Currently, the conventional-changelog-conventionalcommits preset filters out references that already appear in issues:

// remove references that already appear in the subject
commit.references = commit.references.filter(reference => {
if (issues.indexOf(reference.prefix + reference.issue) === -1) {
return true
}
return false
})

The problem is that sometimes references can include duplicate items, which is not handled, but can be easily done:

commit.references = commit.references.reduce((unique, item) => unique.find(e => e.issue === item.issue) ? unique : [...unique, item], []) // filter our duplicates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant