Meekdai / Gmeek

Gmeek is a Blog All in Github
https://meekdai.github.io
MIT License
1.53k stars 224 forks source link

fix: 修复编辑issue内容后触发workflow时报[KeyError: 'ogImage']的错误 #92

Closed wuyiwai closed 2 months ago

wuyiwai commented 2 months ago

如题:在二次编辑issue的内容重新保存后会触发workflow,其中Gmeek.py第463行会报key error

GitHub Pages URL:  https://wuyiwai.github.io
Traceback (most recent call last):
  File "Gmeek.py", line 463, in <module>
    del blog.blogBase["postListJson"][i]["ogImage"]
KeyError: 'ogImage'
blogBase is exists and issue_number!=0, runOne
====== start create static html ======
create postPage title=2024年5月见闻 file=docs/post/2024-nian-5-yue-jian-wen.html 
topNum=0 postNum=2
create docs/index.html
create tag.html
Meekdai commented 2 months ago

这个错误是因为之前更新了新功能,支持了ogImage。更新新版本之后只要手动执行一次全局生成就不会再报这个错误的。

wuyiwai commented 2 months ago

这个错误是因为之前更新了新功能,支持了ogImage。更新新版本之后只要手动执行一次全局生成就不会再报这个错误的。

我已经手动运行过一次,下图成功的一次run是我手动全局运行的。第二次是再次编辑issue时触发的

image image
Meekdai commented 2 months ago

你的手动执行是在12个小时之前,但是我看你的仓库里面的文件,特别是blogBase.json还是3个月前更新的,是怎么回事? 因为blogBase.json里面没有ogImage所以会报错的,你手动更新一次,blogBase.json 就会重新生成一次,就不会报错的。

Meekdai commented 2 months ago

https://github.com/wuyiwai/wuyiwai.github.io/actions/runs/9354845633/job/25748624350

我发现原因了,你仓库设置貌似有问题,应该是你后来修改了什么东西导致的,现在actions无法更新你仓库内的文件了。 image

wuyiwai commented 2 months ago

https://github.com/wuyiwai/wuyiwai.github.io/actions/runs/9354845633/job/25748624350

我发现原因了,你仓库设置貌似有问题,应该是你后来修改了什么东西导致的,现在actions无法更新你仓库内的文件了。 image

我定位一下我仓库的设置

wuyiwai commented 2 months ago

https://github.com/wuyiwai/wuyiwai.github.io/actions/runs/9354845633/job/25748624350 我发现原因了,你仓库设置貌似有问题,应该是你后来修改了什么东西导致的,现在actions无法更新你仓库内的文件了。 image

我定位一下我仓库的设置

已解决。是因为我在创建仓库时设置了分支保护规则。锁住main分支了。修改保护规则即可。感谢!