Github Action 中增加了生成 OPML 文件的脚本 fix #58
* add updating feed.opml to github action * add blog.singee.me * update README and feed.opml after adding blog(s)
This commit is contained in:
parent
f3fd153453
commit
fae1a5b5fb
|
@ -1,9 +1,12 @@
|
|||
name: update readme
|
||||
name: Update readme and feed.opml
|
||||
|
||||
on:
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'blogs-original.csv'
|
||||
paths:
|
||||
- 'blogs-original.csv'
|
||||
- 'opml_generator.py'
|
||||
- 'script.js'
|
||||
- '.github/workflows/updateInfo.yml'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
@ -16,16 +19,23 @@ jobs:
|
|||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 12.x
|
||||
- name: Set up Python 3.7
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: 3.7
|
||||
- name: update readme
|
||||
run: |
|
||||
npm install
|
||||
node script.js
|
||||
- name: Generate feed.opml
|
||||
run: |
|
||||
python opml_generator.py
|
||||
- name: Commit files
|
||||
run: |
|
||||
git config --local user.email "actions@github.com"
|
||||
git config --local user.name "GitHub Action"
|
||||
git add .
|
||||
git commit -m "update readme after adding blog(s)" -a
|
||||
git add README.md feed.opml
|
||||
git commit -m "update README and feed.opml after adding blog(s)"
|
||||
- name: Push changes
|
||||
uses: ad-m/github-push-action@master
|
||||
with:
|
|
@ -184,6 +184,7 @@
|
|||
| [![](https://badgen.net/badge/icon/*?icon=rss&label)](https://blog.ixk.me/feed) | 青空之蓝 | https://blog.ixk.me | 编程; 随笔; Web开发; |
|
||||
| [![](https://badgen.net/badge/icon/*?icon=rss&label)](https://huiweishijie.com/feed.xml) | 回未视戒 | https://huiweishijie.com | 设计; 读书; 日记 |
|
||||
| [![](https://badgen.net/badge/icon/*?icon=rss&label)](https://zhengzexin.com/feed/) | 郑泽鑫的博客 | https://zhengzexin.com/ | 编程; 生物信息学; 生活; |
|
||||
| [![](https://badgen.net/badge/icon/*?icon=rss&label)](https://blog.singee.me/atom.xml) | Origin | https://blog.singee.me/ | 编程;Python;全栈 |
|
||||
| [![](https://badgen.net/badge/icon/*?icon=rss&label)](http://shrekshao.github.io/feed.xml) | ShrekShao | http://shrekshao.github.io | 编程; |
|
||||
| [![](https://badgen.net/badge/icon/*?icon=rss&label)](https://ridiqulous.com/feed) | RidiQulous | https://ridiqulous.com | 图像处理; 乐高; |
|
||||
| [![](https://badgen.net/badge/icon/*?icon=rss&label)](https://vzardlloo.github.io/atom.xml) | vzard's blog | https://vzardlloo.github.io | 编程; |
|
||||
|
|
|
@ -258,4 +258,5 @@ Xieisabug, https://www.xiejingyang.com/, https://www.xiejingyang.com/feed/, 编
|
|||
老镭, https://www.wolone.wang/, https://www.wolone.wang/feed/, 编程; 生活;
|
||||
Scott Yeung's Blog, http://scottyeung.club/, http://scottyeung.club/atom.xml, 编程; 算法; 思考; WEB; 随笔;
|
||||
hywel前端个人博客, http://www.hywel.cn/, , 编程; 前端; WEB; 随笔;
|
||||
LarsCheng, https://www.larscheng.com/, https://www.larscheng.com/atom.xml, 编程; Java; 生活;
|
||||
LarsCheng, https://www.larscheng.com/, https://www.larscheng.com/atom.xml, 编程; Java; 生活;
|
||||
Origin, https://blog.singee.me/, https://blog.singee.me/atom.xml, 编程;Python;全栈
|
||||
|
|
|
|
@ -0,0 +1,32 @@
|
|||
from xml.sax.saxutils import quoteattr
|
||||
|
||||
|
||||
with open('blogs-original.csv', 'r') as f:
|
||||
file_content = f.read()
|
||||
|
||||
lines = file_content.split('\n')
|
||||
|
||||
HEAD = '<?xml version="1.0" encoding="UTF-8"?><opml version="1.0"><head><title>中文独立博客列表</title></head><body>'
|
||||
END = '</body></opml>'
|
||||
ITEM = '<outline text={title} title={title} type="rss" xmlUrl={rss_link} htmlUrl={link}/>'
|
||||
|
||||
content = HEAD
|
||||
|
||||
for line in lines[1:]:
|
||||
line = line.strip()
|
||||
if not line:
|
||||
continue
|
||||
|
||||
parts = line.split(',')
|
||||
if len(parts) != 4:
|
||||
continue
|
||||
parts = [part.strip() for part in parts]
|
||||
|
||||
if parts[2]:
|
||||
content += ITEM.format(title=quoteattr(parts[0]), link=quoteattr(parts[1]), rss_link=quoteattr(parts[2]))
|
||||
|
||||
content += END
|
||||
|
||||
with open('feed.opml', 'w') as f:
|
||||
f.write(content)
|
||||
|
Loading…
Reference in New Issue