dockge/extra/reformat-changelog.ts

63 lines
1.3 KiB
TypeScript
Raw Normal View History

2023-11-21 13:44:27 +01:00
// Generate on GitHub
const input = `
* Add Korean translation by @Alanimdeo in https://github.com/louislam/dockge/pull/86
`;
const template = `
2023-12-10 14:20:08 +01:00
> [!WARNING]
>
2023-11-21 13:44:27 +01:00
### 🆕 New Features
2023-12-15 11:11:21 +01:00
-
2023-11-21 13:44:27 +01:00
2023-12-10 14:20:08 +01:00
### Improvements
2023-12-15 11:11:21 +01:00
-
2023-11-21 13:44:27 +01:00
2023-12-10 14:20:08 +01:00
### 🐛 Bug Fixes
2023-12-15 11:11:21 +01:00
-
2023-11-21 13:44:27 +01:00
### 🦎 Translation Contributions
2023-12-15 11:11:21 +01:00
-
2023-11-21 13:44:27 +01:00
2023-12-10 14:20:08 +01:00
### Security Fixes
2023-12-15 11:11:21 +01:00
-
2023-12-10 14:20:08 +01:00
2023-11-21 13:44:27 +01:00
### Others
- Other small changes, code refactoring and comment/doc updates in this repo:
2023-12-15 11:11:21 +01:00
-
2023-12-10 14:20:08 +01: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 13:44:27 +01: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 14:20:08 +01:00
let thanks = "";
if (username != "@louislam") {
thanks = `(Thanks ${username})`;
}
console.log(pullRequestID, message, thanks);
2023-11-21 13:44:27 +01:00
}
console.log(template);