Created
August 23, 2022 18:19
-
-
Save maxpatiiuk/e7b6d3a397850af96a328e0723236e4d to your computer and use it in GitHub Desktop.
Convert Github Issue list to a markdown changelog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extractNumber = (href)=>href.match(/issues\/(?<number>\d+)/)?.groups.number; | |
categories = $$('a.markdown-title').map(v=>{ | |
const href = v.href; | |
const title = v.textContent; | |
const number = extractNumber(href); | |
const formattedNumber = typeof number === 'string' ? `#${number}` : href; | |
const isBug = v.nextElementSibling.textContent.includes('type:bug'); | |
return [isBug ? 'Fixed' : 'Added',`- ${title} ([${formattedNumber}](${href}))`]; | |
}).reduce((total, [type,line])=>{ | |
total[type] ??= []; | |
total[type].push(line); | |
return total; | |
}, {}); | |
Object.entries(categories) | |
.map(([label, lines])=>`### ${label}\n\n${lines.join('\n')}`).join('\n\n'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment