dockge/extra/reformat-changelog.ts

67 lines
1.8 KiB
TypeScript
Raw Permalink Normal View History

2023-11-21 12:44:27 +00:00
// Generate on GitHub
const input = `
2023-12-16 22:21:24 +00:00
* Fixed envsubst issue by @louislam in https://github.com/louislam/dockge/pull/301
* Fix: Only adding folders to stack with a compose file. by @Ozy-Viking in https://github.com/louislam/dockge/pull/299
* Terminal text cols adjusts to terminal container. by @Ozy-Viking in https://github.com/louislam/dockge/pull/285
* Update Docker Dompose plugin to 2.23.3 by @louislam in https://github.com/louislam/dockge/pull/303
* Translations update from Kuma Weblate by @UptimeKumaBot in https://github.com/louislam/dockge/pull/302
2023-11-21 12:44:27 +00:00
`;
const template = `
2023-12-10 13:20:08 +00:00
> [!WARNING]
>
2023-11-21 12:44:27 +00:00
### 🆕 New Features
2023-12-15 10:11:21 +00:00
-
2023-11-21 12:44:27 +00:00
2023-12-10 13:20:08 +00:00
### Improvements
2023-12-15 10:11:21 +00:00
-
2023-11-21 12:44:27 +00:00
2023-12-10 13:20:08 +00:00
### 🐛 Bug Fixes
2023-12-15 10:11:21 +00:00
-
2023-11-21 12:44:27 +00:00
### 🦎 Translation Contributions
2023-12-15 10:11:21 +00:00
-
2023-11-21 12:44:27 +00:00
2023-12-10 13:20:08 +00:00
### Security Fixes
2023-12-15 10:11:21 +00:00
-
2023-12-10 13:20:08 +00:00
2023-11-21 12:44:27 +00:00
### Others
- Other small changes, code refactoring and comment/doc updates in this repo:
2023-12-16 22:21:24 +00:00
-
2023-12-10 13:20:08 +00:00
Please let me know if your username is missing, if your pull request has been merged in this version, or your commit has been included in one of the pull requests.
2023-11-21 12:44:27 +00:00
`;
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();
2023-12-10 13:20:08 +00:00
let thanks = "";
if (username != "@louislam") {
thanks = `(Thanks ${username})`;
}
console.log(pullRequestID, message, thanks);
2023-11-21 12:44:27 +00:00
}
console.log(template);