Skip to content

Commit

Permalink
docs: update issue 349
Browse files Browse the repository at this point in the history
  • Loading branch information
toFrankie committed Aug 16, 2024
1 parent ca30e2d commit d6377c0
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions archives/2024/349.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: 使用 GitHub 作为博客之后,可以利用 GitHub Actions 做哪些
number: '#349'
link: 'https://github.com/toFrankie/blog/issues/349'
created_at: '2024-08-12 23:47:51'
updated_at: '2024-08-17 00:28:35'
updated_at: '2024-08-17 00:57:16'
labels:
- '2024'
- 生活随笔
Expand All @@ -14,7 +14,7 @@ labels:

现在,issues 页就是文章列表,README 就是主页。

> 📢 你也可以使用 [Github Blogger](https://github.com/toFrankie/github-blogger) 构建你的博客,只需一个仓库就可以开始了。
📢 你也可以使用 [Github Blogger](https://github.com/toFrankie/github-blogger) 构建你的博客,只需一个仓库就可以开始了。

接下来,我会介绍一些利用自动化流程来更新 README 等操作。

Expand Down Expand Up @@ -60,6 +60,21 @@ labels:
## 文章统计

可以做些什么呢?

比如:

- 字数统计
- 每年文章数
- 近期热门文章
- 近期创建/更新的文章

字数统计我暂时没做,思路很简单,获取所有 issues,统计 issue.body 渲染成 Markdown 格式后的字数,打算参考 [ByteMd](https://github.com/bytedance/bytemd/blob/9f2212203c780f2d9775e3c2243171cdeea2e81d/packages/bytemd/src/status.svelte#L15)

每年文章数,遍历所有 issues,根据 issue.created_at 判断年份,可得出数据。我个人的话,更喜欢添加一个年份 Label,并利用 GitHub Issue 筛选功能,以便于快速查看每年所写文章,而且我有一些往年在简书写的文章,也是从去年从迁到 GitHub 上,所以创建时间也对不上。

近期热门文章,其实跟上一章节 Traffic 是相关的,它可以获取近两周排名前 10 的内容,但不单指 issue 内容,还有其他的。只能根据返回的 path 过滤得到对应的 issue。

近期创建/更新的文章,可以设置一个 Workflow,每当 issue 被创建或编辑时触发,然后也是通过 [List repository issues](https://docs.github.com/zh/rest/issues/issues?apiVersion=2022-11-28#list-repository-issues) 接口获取近 10 篇,加个排序 sort = updated 即可。可参考[我的](https://github.com/toFrankie/blog/blob/ca30e2dff739ecb61515fe05922033bf23624a29/scripts/common.js#L33)

未完待续...

0 comments on commit d6377c0

Please sign in to comment.