mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 07:35:05 -04:00
Added changelog generator.
This commit is contained in:
parent
b805d976e1
commit
1aef6e5a99
3 changed files with 51 additions and 92 deletions
41
bin/generateReleaseNotes.ts
Normal file
41
bin/generateReleaseNotes.ts
Normal file
|
@ -0,0 +1,41 @@
|
|||
import {readFileSync} from "node:fs";
|
||||
|
||||
const changelog = readFileSync('../changelog.md')
|
||||
const changelogText = changelog.toString()
|
||||
const changelogLines = changelogText.split('\n')
|
||||
|
||||
|
||||
let cliArgs = process.argv.slice(2)
|
||||
|
||||
let tagVar = cliArgs[0]
|
||||
|
||||
if (!tagVar) {
|
||||
console.error("No tag provided")
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
console.log("Tag",tagVar)
|
||||
|
||||
tagVar = tagVar.replace("refs/tags/v", "")
|
||||
|
||||
let startNum = -1
|
||||
let endline = 0
|
||||
|
||||
let counter = 0
|
||||
for (const line of changelogLines) {
|
||||
if (line.trim().startsWith("#") && (line.match(new RegExp("#", "g"))||[]).length === 1) {
|
||||
if (startNum !== -1) {
|
||||
endline = counter-1
|
||||
break
|
||||
}
|
||||
|
||||
const sanitizedLine = line.replace("#","").trim()
|
||||
if(sanitizedLine.includes(tagVar)) {
|
||||
startNum = counter
|
||||
}
|
||||
}
|
||||
counter++
|
||||
}
|
||||
|
||||
let currentReleaseNotes = changelogLines.slice(startNum, endline).join('\n')
|
||||
console.log("Generated changelog",currentReleaseNotes)
|
Loading…
Add table
Add a link
Reference in a new issue