diff --git a/extra/reformat-changelog.ts b/extra/reformat-changelog.ts new file mode 100644 index 0000000..cba6605 --- /dev/null +++ b/extra/reformat-changelog.ts @@ -0,0 +1,42 @@ +// Generate on GitHub +const input = ` +* Add Korean translation by @Alanimdeo in https://github.com/louislam/dockge/pull/86 +`; + +const template = ` +### 🆕 New Features + +### Improvements + +### 🐞 Bug Fixes + +### 🦎 Translation Contributions + +### Others +- Other small changes, code refactoring and comment/doc updates in this repo: +`; + +const lines = input.split("\n").filter((line) => line.trim() !== ""); + +for (const line of lines) { + // Split the last " by " + const usernamePullRequesURL = line.split(" by ").pop(); + + if (!usernamePullRequesURL) { + console.log("Unable to parse", line); + continue; + } + + const [ username, pullRequestURL ] = usernamePullRequesURL.split(" in "); + const pullRequestID = "#" + pullRequestURL.split("/").pop(); + let message = line.split(" by ").shift(); + + if (!message) { + console.log("Unable to parse", line); + continue; + } + + message = message.split("* ").pop(); + console.log("-", pullRequestID, message, `(Thanks ${username})`); +} +console.log(template); diff --git a/package.json b/package.json index 4f16e8e..cde791f 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,8 @@ "build:docker": "node ./extra/env2arg.js docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/dockge:latest -t louislam/dockge:1 -t louislam/dockge:$VERSION --target release -f ./docker/Dockerfile . --push", "build:docker-nightly": "pnpm run build:frontend && docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/dockge:nightly --target nightly -f ./docker/Dockerfile . --push", "start-docker": "docker run --rm -p 5001:5001 --name dockge louislam/dockge:latest", - "mark-as-nightly": "tsx ./extra/mark-as-nightly.ts" + "mark-as-nightly": "tsx ./extra/mark-as-nightly.ts", + "reformat-changelog": "tsx ./extra/reformat-changelog.ts" }, "dependencies": { "@homebridge/node-pty-prebuilt-multiarch": "~0.11.11",