想用 github 来实现一个简单的记录心情或者事件的博客, 每个 commit 就会在生成一个状态,包含时间和内如,就像 github 的 release 列表一样。 但是如何读取提交记录呢?没有找到 json 文件什么的, 有知道告知一下;
另外,有一个 nodejs 实现的类似的项目, https://byronhsu.github.io/life-commit/,大家可以看看
1 jasonsui 2019-06-27 14:54:16 +08:00 via Android webhook |
![]() | 2 Ritter 2019-06-27 15:05:01 +08:00 插眼等大佬解答 |
![]() | 3 npe 2019-06-27 15:15:30 +08:00 via Android ![]() 花里胡哨。。。 |
![]() | 4 Sanko 2019-06-27 15:37:42 +08:00 via Android commit 有长度限制吗 |
![]() | 5 xaplux 2019-06-27 15:38:52 +08:00 感觉可以用 github 的 api 接口实现,developer.github.com/v3/repos/commits/ |
6 yuankui 2019-06-27 15:44:06 +08:00 http://qinghua.github.io/jgit/ 如果是 java 语言的话,可以用这个库,可以直接读取.git 仓库。包含所有你需要的元数据信息。 如果是其他语言的话,可以在这里找找: https://git-scm.com/book/uz/v2/Appendix-B%3A-Embedding-Git-in-your-Applications-Libgit2 |
7 yuankui 2019-06-27 15:45:21 +08:00 最后的最后,可以寄出大杀器:爬虫。 |
![]() | 8 KuroNekoFan 2019-06-27 15:47:57 +08:00 git webhook |
![]() | 9 KuroNekoFan 2019-06-27 15:49:02 +08:00 跟 commit 自动触发 ci/cd 一个道理 |
10 Northxw 2019-06-27 15:49:30 +08:00 爬虫 |
![]() | 11 moodasmood 2019-06-27 15:50:15 +08:00 花里胡哨+1 |
![]() | 12 andyhuai OP |
![]() | 13 KuroNekoFan 2019-06-27 16:08:28 +08:00 @andyhuai 方法应该不限于一种,就我知道的,git cmd tool,比如 ``` git ls-remote --tags ${repoURI} ``` 可以拿到这个 repoURI 对应的 tag 信息 |
14 pupboss 2019-06-27 16:53:41 +08:00 ![]() commit 之前仓库要有改动才行,虽然也很容易实现,我还是想跟风说一个。。。花里胡哨+2 |
15 deepdark 2019-06-27 17:10:15 +08:00 via Android 可以修改覆写.git 目录里的 hooks 文件夹里的内容,你的需求需要修改 post-commit,具体流程就是在你仓库 commit 的时候 bash 脚本拿到 commit msg 然后做你想要的操作,生成 markdown 发布博客或者是调用 web 接口都可以 |
![]() | 16 jingyulong 2019-06-27 21:54:20 +08:00 官方接口可以做到啊。。。。。啥数据都有,https://developer.github.com/v4/guides/intro-to-graphql/ |
![]() | 17 kawana 2019-06-27 23:37:00 +08:00 ![]() @pupboss 不一定需要有改动, `git commit --allow-empty` 可以提交空 commit,不过还是 「花里胡哨」 |
19 JiYouMCC 2019-06-28 16:41:00 +08:00 github api graphql |
20 JiYouMCC 2019-06-28 16:42:07 +08:00 不一定要 comment,还可以起个 issue,然后用 issue 的帖子内容生成,这样就还能支持修改删除啥的 |