From ce62f88ad743ffc7ff0b82053cdfa09b6cfce285 Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Sun, 15 Sep 2024 23:45:45 +0800 Subject: [PATCH] chore: update issue template scripts --- .github/scripts/create-rss.mjs | 21 +++++++++++++++++++-- .github/workflows/deploy.yml | 1 + docs/README.md | 9 +++++++-- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/.github/scripts/create-rss.mjs b/.github/scripts/create-rss.mjs index 3452a17..5c93c6f 100644 --- a/.github/scripts/create-rss.mjs +++ b/.github/scripts/create-rss.mjs @@ -98,6 +98,13 @@ const rssFilePath = `./docs/rss/${year}-${week}.json`; await fs.writeJSON(rssFilePath, rss, { spaces: 2 }); // 输出写入成功日志 info(`RSS 文件写入成功:${rssFilePath}`); + + const oldRss = await fs.readJSON('./docs/rss.json'); + // oldRss.items 和 rss.items 合并 + // 新的 newItems 根据时间排序,通过id 去重 + const rssItems = oldRss.items.concat(rss).sort((a, b) => new Date(b.date_published) - new Date(a.date_published)) + .filter((item, index, self) => self.findIndex(t => t.id === item.id) === index) + .slice(0, 100); const feed = new Feed({ title: "Quick RSS Feed", @@ -121,8 +128,10 @@ const rssFilePath = `./docs/rss/${year}-${week}.json`; link: "https://wangchujiang.com/" } }); - - rss.forEach(post => { + + let mdListContent = ""; + rssItems.forEach(post => { + mdListContent += `- [${post.title}](${post.url}) [#${post.id}](https://github.com/jaywcjlove/quick-rss/issues/${post.id})\n`; feed.addItem({ title: post.title, id: post.id, @@ -139,6 +148,14 @@ const rssFilePath = `./docs/rss/${year}-${week}.json`; ], }) }) + + const markdownContent = fs.readFileSync('./docs/README.md', 'utf-8'); + // + const contentx = markdownContent.replace(/[\s\S]*/g, `\n${mdListContent}\n`); + fs.writeFileSync('./docs/README.md', contentx); + // 输出写入成功日志 + info(`README.md 文件写入成功:./docs/README.md`); + const jsonFeedPath = './docs/feed.json'; await fs.writeFile(jsonFeedPath, feed.json1()); info(`JSON Feed 文件写入成功:${jsonFeedPath}`); diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 8bb884a..d6ca6d0 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -54,6 +54,7 @@ jobs: target: __blank sideEffectFiles: - README.zh.md + - docs/README.md - terms-of-service.md - terms-of-service.zh.md - privacy-policy.md diff --git a/docs/README.md b/docs/README.md index e86fe97..014901a 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,8 +1,13 @@ Quick RSS Feed === -Recording and sharing tech content, thank you for your contribution! Please provide the following information to submit, recommend, or self-recommend your articles, software, or resources, which will be added to Quick RSS subscriptions by default. +Thank you for recording and sharing tech content! You can subscribe to the valuable content shared by the community through the RSS link below. Additionally, you can submit, recommend, or self-nominate your articles, software, or resources via an issue, and they will be automatically added to the RSS feed. ``` https://wangchujiang.com/quick-rss/atom.xml -``` \ No newline at end of file +``` + +## 内容列表 + + + \ No newline at end of file