Skip to content

Commit

Permalink
Strip headers and todos from change descriptions (#290)
Browse files Browse the repository at this point in the history
  • Loading branch information
JAForbes authored Mar 6, 2022
1 parent bf8fda9 commit 8fd38f6
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,6 @@ async function inferVersion({ owner, repo, lastRelease }){

function changeDescription(x, { owner, repo }){


let sentences = []
let length = 0;
let stack =
Expand All @@ -765,12 +764,17 @@ function changeDescription(x, { owner, repo }){
.flatMap( x => x.split(/\.\s/g))
.map( x => x.trim() )
.map( x => {
if( x.startsWith('#') ) {
return x.replace(/^\#+ /,'').replace(/\.|:$/, '') + ':'
// strip headers and todos
if(
x.startsWith('#')
|| x.toLowerCase().startsWith('- [ ]')
|| x.toLowerCase().startsWith('- [x]')
) {
return ''
}
return x
})
.map( x => x.replace(/^(\+|\*|\- \[ \]|- \[x\]|- \[X\]|\-) /, ''))
.map( x => x.replace(/^(\+|\*|\-) /, ''))
.filter(Boolean)
.map( x => x.endsWith('.') || x.endsWith(':') ? x : x + '.' )

Expand Down

0 comments on commit 8fd38f6

Please sign in to comment.