Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

这个博客开源了 #177

Open
yihong0618 opened this issue Aug 20, 2020 · 138 comments
Open

这个博客开源了 #177

yihong0618 opened this issue Aug 20, 2020 · 138 comments
Labels
Top Top label of gitblog 技术文章 技术文章

Comments

@yihong0618
Copy link
Owner

yihong0618 commented Aug 20, 2020

因为一篇去年非常触动我的文章--People Die, but Long Live GitHub
我决定不再用纸笔写日记,进而全部转到 GitHub 上。如果你看到这个,这个其实不是那些大牛的技术博客,而是单纯的碎碎念偶尔认真的记录自己而已。


虽然如此但也经历了几个阶段

  1. 纯粹的写issue
  2. 写完issue后添加目录到README
  3. 改成webhook用flask部署个callback 每次写完issue自动生成新的 README
  4. 最近算是学会了一些 GitHub Actions,现在只需要写 issue 打 label 就好了,其余完全不用管。核心代码在 main.py
  5. 支持了 RSS

如果你也想自己写issue博客,并自动生成README,你可以参考如下步骤

  1. fork this repo (or just copy the file whatever)
  2. change GitHub secret
  3. write issue and add label
  4. please delete all files in BACKUP folder(2020.11.26 add)
  5. 别忘了在 settings 里打开 Actions 读写的权限

关于如何生成 GitHub secret token

image

  1. 这里 点击 generate new token把需要的点上
  2. 在你的repo 中更改 secret 中把刚生成的token设置进去
    image
  3. 更改workflow中的token name 换成你自己的(不要忘了secrets 点)
    image

需要把 env 中的 name 和 email 改成自己的
image

@yihong0618 yihong0618 added 技术文章 技术文章 Top Top label of gitblog labels Aug 20, 2020
@yihong0618
Copy link
Owner Author

2020.08.24更新: 增加了显示更多。 完善了置顶功能,现在只需要打label就可以了。

@yihong0618
Copy link
Owner Author

现在不用改任何东西在main.py了只需要更改自己的token就可以了,增加了todo标签

@yihong0618
Copy link
Owner Author

完善了todo标签,优化了一点点代码。

@Aaronwn
Copy link

Aaronwn commented Aug 29, 2020

你好,有自己的blog,直接copy你的main.py可以吗

@yihong0618
Copy link
Owner Author

yihong0618 commented Aug 29, 2020

你好,有自己的blog,直接copy你的main.py可以吗

@Aaronwn
当然可以啊。但是你还得把 .github那个文件夹拷贝过去。那个是action用的,还得生成自己的github secret token 我这里叫G_T你可以改成你自己的名字,如果有问题随时问我可以。之后你就可以写issue 打label就行。

@yihong0618
Copy link
Owner Author

把 todo list 放在下面了, 如果想放在最上可以修改 write md 的函数顺序

@yihong0618
Copy link
Owner Author

增加了一些教程。

@yihong0618
Copy link
Owner Author

image

@yihong0618
Copy link
Owner Author

image

image

image

@superleeyom
Copy link

superleeyom commented Nov 8, 2020

cool,之前也想把文章整合进readme中,看到这篇文章,发现了你再底下的留言,真是太巧了吧,他这个感觉就太花哨了,你这个挺符合我的要求的,拷贝你的这些workflows yml等文件后,完美使用,只是这个generate_readme.yml 里的:

- name: Push README
uses: github-actions-x/commit@v2.6
with:
    github-token: ${{ secrets.G_T }}
    commit-message: "Refresh README"
    files: README.md
    rebase: 'true'
    name: superleeyom 
    email: 635709492@qq.com

一定要改成自己的 name 和 email,否则就会以当前 name 的用户更新 README.md,我拷贝过来后忘记改了,然后恭喜 @yihong0618 成为我 blog 仓库的 contributor,哈哈,记得改过来就行

@yihong0618
Copy link
Owner Author

@superleeyom 世界真小。我当时看到他那个了。当时还没有actions, 我决定自己写,用的hooks,后来有actions了改的actions哈哈。

@yihong0618
Copy link
Owner Author

@superleeyom 这个有 TODO 和 TOP 的特殊标签,可以方便使用。

@superleeyom
Copy link

@yihong0618 nice👍

@yihong0618
Copy link
Owner Author

@superleeyom 把 env 提出来了,放在了 top 防止大家忘了更改。

@egolearner
Copy link

使用了@yihong0618 生成README的脚本和action🌷。
加上了保存issue到备份目录的功能,有需要可以自取。
https://github.com/egolearner/paper-note/blob/master/tools/issue2md.py
https://github.com/egolearner/paper-note/blob/master/.github/workflows/issue2md.yml

@yihong0618
Copy link
Owner Author

@egolearner cool~

@superleeyom
Copy link

就是说,可以把issue转为markdown进行备份吗? @egolearner

@egolearner
Copy link

@superleeyom
Copy link

@egolearner 我刚试了下,似乎失败了,提示截图如下:
image
我将 issue2md.py 和 issue2md.yml 分别拷贝到了我的仓库

@superleeyom
Copy link

找到问题了,是 issue2md.yml 里的路径弄错了,因为我直接贴到跟目录,没有 tools 目录,去掉就ok,但是又出现另外一个错误:
image

@superleeyom
Copy link

手动触发执行的action,跟这个有关系吗?
image
@egolearner

@egolearner
Copy link

@superleeyom 这个脚本在issue创建或更新的时候执行,将单个issue保存为md提交到repo中
你可以编辑一个issue试试
手动执行应该获取不到issue number

@superleeyom
Copy link

superleeyom commented Nov 15, 2020

image
好像还是不行哎,是我哪里的配置不对吗? @egolearner

@yihong0618
Copy link
Owner Author

@superleeyom @egolearner 我抽个时间看一下然后集成进去吧,应该有优化的空间。

@yihong0618
Copy link
Owner Author

增加了 back up 功能,去掉了 kb.

@yihong0618
Copy link
Owner Author

@superleeyom @egolearner 整合进去了,谢谢。
更改了一些代码,把两个 Actions 整合成一个 Actions 了,也考虑到了不是 Issues 触发,变得更通用了些。

@mattheliu
Copy link

你好,博主,想问一下我为什么没有生成主页README文件
1704338060202
Uploading 1704338121052.png…

@yihong0618
Copy link
Owner Author

@mattheliu 可能你 actions 没跑

@mattheliu
Copy link

1704338121052
1704339013843
是不是我还有哪里没有更改

@yihong0618
Copy link
Owner Author

@mattheliu
嗯。。你需要复制我的 README 再跑一次,因为他找不到 README 和找不到里面需要替换的字符所以没成功。
你可以研究下代码就懂为什么了

@mattheliu
Copy link

非常感谢博主,解决了!

@JosieWei2023
Copy link

配置新的 secret 需要有写的权限。GitHub Actions 也要添加写的权限

我捣鼓了两个小时才发现是因为权限没开通,建议加到教程里。。再次谢谢大佬

@yihong0618
Copy link
Owner Author

配置新的 secret 需要有写的权限。GitHub Actions 也要添加写的权限

我捣鼓了两个小时才发现是因为权限没开通,建议加到教程里。。再次谢谢大佬

好的,谢谢。

@ethanchengyu
Copy link

大佬,我写完issue检查action发现有个报错,可是不太懂,我这部分没有修改,不知道那里出了问题,麻烦解答一下。谢谢。

15行jobs:
sync:
name: Generate README
runs-on: ubuntu-latest
if: github.repository_owner_id == github.event.issue.user.id || github.event_name == 'push'
20行 steps:
Check failure on line 20 in .github/workflows/generate_readme.yml

GitHub Actions
/ .github/workflows/generate_readme.yml
Invalid workflow file
You have an error in your yaml syntax on line 20
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4

@geoqiao
Copy link

geoqiao commented Jan 6, 2024

大佬,我写完issue检查action发现有个报错,可是不太懂,我这部分没有修改,不知道那里出了问题,麻烦解答一下。谢谢。

15行jobs: sync: name: Generate README runs-on: ubuntu-latest if: github.repository_owner_id == github.event.issue.user.id || github.event_name == 'push' 20行 steps: Check failure on line 20 in .github/workflows/generate_readme.yml

GitHub Actions / .github/workflows/generate_readme.yml Invalid workflow file You have an error in your yaml syntax on line 20 - name: Checkout uses: actions/checkout@v3 - name: Set up Python uses: actions/setup-python@v4

看报错好像是user.id没识别对,可以排查下:

  1. 看到你的 repo 的 action 文件中的 Push README 部分跟原来的写法不太一样
  2. 看到你自定义了token名称,是不是在脚本中没有对应修改
@geoqiao
Copy link

geoqiao commented Jan 6, 2024

大佬,我写完issue检查action发现有个报错,可是不太懂,我这部分没有修改,不知道那里出了问题,麻烦解答一下。谢谢。
15行jobs: sync: name: Generate README runs-on: ubuntu-latest if: github.repository_owner_id == github.event.issue.user.id || github.event_name == 'push' 20行 steps: Check failure on line 20 in .github/workflows/generate_readme.yml
GitHub Actions / .github/workflows/generate_readme.yml Invalid workflow file You have an error in your yaml syntax on line 20 - name: Checkout uses: actions/checkout@v3 - name: Set up Python uses: actions/setup-python@v4

看报错好像是user.id没识别对,可以排查下:

  1. 看到你的 repo 的 action 文件中的 Push README 部分跟原来的写法不太一样
  2. 看到你自定义了token名称,是不是在脚本中没有对应修改

如果你的Push README 写法对的话,是不是缩进有问题
不太懂 GitHub Action ,希望能有帮助

@ethanchengyu
Copy link

大佬,我写完issue检查action发现有个报错,可是不太懂,我这部分没有修改,不知道那里出了问题,麻烦解答一下。谢谢。
15行jobs: sync: name: Generate README runs-on: ubuntu-latest if: github.repository_owner_id == github.event.issue.user.id || github.event_name == 'push' 20行 steps: Check failure on line 20 in .github/workflows/generate_readme.yml
GitHub Actions / .github/workflows/generate_readme.yml Invalid workflow file You have an error in your yaml syntax on line 20 - name: Checkout uses: actions/checkout@v3 - name: Set up Python uses: actions/setup-python@v4

看报错好像是user.id没识别对,可以排查下:

  1. 看到你的 repo 的 action 文件中的 Push README 部分跟原来的写法不太一样
  2. 看到你自定义了token名称,是不是在脚本中没有对应修改

如果你的Push README 写法对的话,是不是缩进有问题 不太懂 GitHub Action ,希望能有帮助

竟然是缩进,现在没有报错了,可是backup中也没有出现issue新增的md文件,在readme中也没看到关联,git用的不熟悉

@yihong0618
Copy link
Owner Author

大佬,我写完issue检查action发现有个报错,可是不太懂,我这部分没有修改,不知道那里出了问题,麻烦解答一下。谢谢。
15行jobs: sync: name: Generate README runs-on: ubuntu-latest if: github.repository_owner_id == github.event.issue.user.id || github.event_name == 'push' 20行 steps: Check failure on line 20 in .github/workflows/generate_readme.yml
GitHub Actions / .github/workflows/generate_readme.yml Invalid workflow file You have an error in your yaml syntax on line 20 - name: Checkout uses: actions/checkout@v3 - name: Set up Python uses: actions/setup-python@v4

看报错好像是user.id没识别对,可以排查下:

  1. 看到你的 repo 的 action 文件中的 Push README 部分跟原来的写法不太一样
  2. 看到你自定义了token名称,是不是在脚本中没有对应修改

如果你的Push README 写法对的话,是不是缩进有问题 不太懂 GitHub Action ,希望能有帮助

竟然是缩进,现在没有报错了,可是backup中也没有出现issue新增的md文件,在readme中也没看到关联,git用的不熟悉

参考楼上的评论,你如果你不太明白原来你需要先用我的 README

@humyna
Copy link

humyna commented Feb 1, 2024

感谢开源,非常👍🏻~~
我简单整理下搭建步骤和一些典型问题,可供后来人参考 humyna/gitblog#1

@haowang-bioinfo
Copy link

这是最近发现的一个非常棒的repo!加油 @yihong0618 💪🏻

@yihong0618
Copy link
Owner Author

请看我的有哪些不对吗?

Screenshot_20240415_085302

Screenshot_20240415_085325_com android browser

打扰了

没设置 secret

@jaaleng
Copy link

jaaleng commented Apr 19, 2024

您好,看图,其中两服务没有运行成功?

image

@jaaleng
Copy link

jaaleng commented Apr 19, 2024

Screenshot_20240419_110602
是这个样

@geoqiao
Copy link

geoqiao commented Apr 19, 2024

Screenshot_20240419_110602

是这个样

看起来是GitHub pages的仓库没有建

@yihong0618
Copy link
Owner Author

Screenshot_20240419_110602
是这个样

看起来是GitHub pages的仓库没有建

不是,你需要在 setting 里把 GitHub page 打开,并且选择 actions

@jaaleng
Copy link

jaaleng commented Apr 19, 2024

Screenshot_20240419_110602
是这个样

看起来是GitHub pages的仓库没有建

不是,你需要在 setting 里把 GitHub page 打开,并且选择 actions

多谢指点,我去试下。

@jaaleng
Copy link

jaaleng commented Apr 20, 2024

Screenshot_20240419_110602
���这个样

看起来是GitHub pages的仓库没有建

不是,你需要在 setting 里把 GitHub page 打开,并且选择 actions

多谢指点,我去试下。
谢谢了。
成功了,但是这个不知什么意思。
Canceling since a higher priority waiting request for 'Deploy static content to Pages' exists

@yihong0618
Copy link
Owner Author

Screenshot_20240419_110602

是这个样

看起来是GitHub pages的仓库没有建

不是,你需要在 setting 里把 GitHub page 打开,并且选择 actions

多谢指点,我去试下。

谢谢了。

成功了,但是这个不知什么意思。

Canceling since a higher priority waiting request for 'Deploy static content to Pages' exists

可以暂时忽略这个

@jaaleng
Copy link

jaaleng commented Apr 20, 2024

Screenshot_20240419_110602

是这个样

看起来是GitHub pages的仓库没有建

不是,你需要在 setting 里把 GitHub page 打开,并且选择 actions

多谢指点,我去试下。

谢谢了。
成功了,但是这个不知什么意思。
Canceling since a higher priority waiting request for 'Deploy static content to Pages' exists

可以暂时忽略这个

谢谢大家了

@jaaleng
Copy link

jaaleng commented Apr 27, 2024

博主好,我如果用xxx.github.io这样的仓库,主页的排班会乱,是不是需要改一些路径。谢谢。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Top Top label of gitblog 技术文章 技术文章