Skip to content

Commit

Permalink
优化历史日志生成逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
xiyuesaves committed Jun 16, 2024
1 parent 639a25d commit 90af503
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions createChangeLog.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ const relesasText =
`## v${packageJSON.version} - ${new Date().toLocaleString("zh-cn", { hour12: false, timeZone: "Asia/Shanghai" })}\n\n` + releaseBody;
const releaseList = [];

releaseList.push(relesasText);

async function getAllRelease(list = [], page = 1) {
const res = await fetch(`https://api.github.com/repos/xiyuesaves/LiteLoaderQQNT-lite_tools/releases?per_page=100&page=${page}`);
const json = await res.json();
Expand All @@ -23,6 +21,12 @@ async function getAllRelease(list = [], page = 1) {
}`,
);
});
if (`v${packageJSON.version}` !== list[0].tag_name) {
console.log("插入当前版本");
releaseList.unshift(relesasText);
} else {
console.log("当前版本已存在");
}
writeFileSync("./changeLog.md", releaseList.join("\n\n"));
}
} else {
Expand Down

0 comments on commit 90af503

Please sign in to comment.