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 5ec1999 commit f70f5d2
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 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-15 00:27:30'
updated_at: '2024-08-16 20:48:56'
labels:
- '2024'
- 生活随笔
Expand Down Expand Up @@ -34,21 +34,16 @@ labels:

数据在手才最安全的。

两个方面:

- 将 issue 内容存到仓库
- 使用 [List repository issues](https://docs.github.com/zh/rest/issues/issues?apiVersion=2022-11-28#list-repository-issues) 获取所有 open issue。
- 将 GitHub 仓库备份到 Gitee(如果你实在担心 GitHub 有一天被封的话)
- 参考《[Gitee 仓库镜像管理](https://gitee.com/help/articles/4336#article-header3)》,只要添加 GitHub → Gitee 方向的镜像就好。
- 之前想用 [hub-mirror-action](https://github.com/Yikun/hub-mirror-action) 来同步,但遇到些[问题](https://github.com/Yikun/hub-mirror-action/issues/188)没解决。

> 如果你用 [Github Blogger](https://github.com/toFrankie/github-blogger) 来管理文章,可以省略第一条,因为每一次内容变更它都会提交到仓库,存放于 archives 目录。
将 issue 内容存到仓库,其 Workflow 步骤:
也可以自定义 GitHub Workflow,在 issue 被创建、被编辑,或定时任务,将 Issue 内容保存到仓库内。

1. 触发条件:[issue 创建或编辑](https://docs.github.com/zh/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#issues)
2. 拉取最新仓库
3. 安装依赖,执行 Node 脚本以生成 issue Markdown 文件:
1. 通过 [List repository issues](https://docs.github.com/zh/rest/issues/issues?apiVersion=2022-11-28#list-repository-issues) 获取获取某个仓库 issues。
2. 遍历 issues,将 issue.body 存到仓库某个路径,比如 `archives/2024/<issue-number>.md`。个人喜欢按年份划分,并在添加上 front-matter 头,可参考[这里](https://github.com/toFrankie/blog/blob/7f52ad3e69141c33ed7c992130d471b34a22df5a/scripts/fetch-all-issues.js#L42)
4. 检查文件是否有变更,若有则推送到远程仓库,无则跳过。
> 如果你用 [Github Blogger](https://github.com/toFrankie/github-blogger) 来管理文章,可以省略第一条,因为每一次内容变更它都会提交到仓库,存放于 archives 目录。
## 仓库访问数据

未完待续...

0 comments on commit f70f5d2

Please sign in to comment.