changelog-action
changelog-action copied to clipboard
Distinguish between `build` and `ci` commit types
"build" and "ci" commit types are currently treated in the same group in the action.
This has been confusing to me, I used the action with the option:
excludeTypes: ci,style,chore,other
and expected that "build" commits (that affect my build tool) would be written in the changelog (while I don't want to write about "ci" commits, since changes on the workflow don't affect the delivered code in the end).
Yet, in the logs of the action I had something like this:
Run requarks/changelog-action@v1
Using tag range: ... to ...
[OK] Commit ... of type build - some build commit
[OK] Commit ... of type ci - some ci commit
Selected Types: feat, feature, fix, bugfix, perf, refactor, test, tests, doc, docs
(No build
, even if it is not in the excludeTypes
)
If I get it correctly, the reason is that 'build' and 'ci' are in the same array in allTypes constant:
https://github.com/requarks/changelog-action/blob/669b3359e57e57caa76ec242528e431d4eaf8029/index.js#L17
const allTypes = [
{ types: ['feat', 'feature'], header: 'New Features', icon: ':sparkles:' },
{ types: ['fix', 'bugfix'], header: 'Bug Fixes', icon: ':bug:', relIssuePrefix: 'fixes' },
{ types: ['perf'], header: 'Performance Improvements', icon: ':zap:' },
{ types: ['refactor'], header: 'Refactors', icon: ':recycle:' },
{ types: ['test', 'tests'], header: 'Tests', icon: ':white_check_mark:' },
{ types: ['build', 'ci'], header: 'Build System', icon: ':construction_worker:' },
{ types: ['doc', 'docs'], header: 'Documentation Changes', icon: ':memo:' },
{ types: ['style'], header: 'Code Style Changes', icon: ':art:' },
{ types: ['chore'], header: 'Chores', icon: ':wrench:' },
{ types: ['other'], header: 'Other Changes', icon: ':flying_saucer:' }
]
which causes to filter both if one of the two is selected:
https://github.com/requarks/changelog-action/blob/669b3359e57e57caa76ec242528e431d4eaf8029/index.js#L264
// -> Filter types
const types = []
for (const type of allTypes) {
if (restrictToTypes.length > 0) {
if (_.intersection(type.types, restrictToTypes).length > 0) {
types.push(type)
}
} else {
if (_.intersection(type.types, excludeTypes).length === 0) {
types.push(type)
}
}
}
core.info(`Selected Types: ${types.map(t => t.types.join(', ')).join(', ')}`)
There is two ways to resolve this:
- add a bit of documentation about it in the readme
- do a little refactor to fix this
It seems to me that the latter would be convenient, I'll link a pull request.